It just parse the website wordnetweb and extract the meaning of the word/phrase given. You need lynx to run this script successfully.
References:
http://ubuntuforums.org/showthread.php?t=371482
http://wordnetweb.princeton.edu/perl/webwn
Saturday, March 26, 2011
Command-line dictionary
Labels:
awk
,
Bash
,
dictionary
,
grep
,
linux
,
lynx
,
Shell scripting
,
wordnetweb
Sunday, January 9, 2011
Heapsort
Heap
Sort in place
Binary tree
Worst case runtime (n lg n)
MIN_HEAP
Maintain the max-heap propert
Heap Sorting
Priority queues
One of the main usage is that we can use max-priority queues to schedule jobs on a shared computer.The max-priority queue keeps track of the jobs to
be performed and their relative priorities. When a job is finished or interrupted,the scheduler selects the highest-priority job from among those pending by calling EXTRACT-MAX. The scheduler can add a new job to the queue at any time by calling INSERT.
Reference: Introduction to Algorithms By Thomas H . Cormen, Charles E. Leiserson, Ronald L. Rivest, Clifford Stein
Sort in place
Binary tree
Worst case runtime (n lg n)
PARENT(i) -> i/2 Left (i) -> 2i Right (i) -> 2i + 1MAX_HEAP
A[PARENT(i)] >= A[i]
MIN_HEAP
A[PARENT(i)] <= A[i]MAX-HEAPIFY
Maintain the max-heap propert
MAX-HEAPIFY (A, i) l = LEFT (i) r = RIGHT (i) if l <= A:heap-size and A[l] > A[i] largest = l else largest = i if r <= A.heap-size and A[r] > A[largest] largest = r if largest != i exchange A[i] with A[largest] MAX-HEAPIFY (A, largest)
Heap Sorting
HEAPSORT (A) BUILD-MAX-HEAP (A) for i = A.length downto 2 exchange A[1] with A[i] A.heap-size = A.heap-size - 1 MAX-HEAPIFY (A, 1)
Priority queues
One of the main usage is that we can use max-priority queues to schedule jobs on a shared computer.The max-priority queue keeps track of the jobs to
be performed and their relative priorities. When a job is finished or interrupted,the scheduler selects the highest-priority job from among those pending by calling EXTRACT-MAX. The scheduler can add a new job to the queue at any time by calling INSERT.
Reference: Introduction to Algorithms By Thomas H
Labels:
algorithms
,
C
,
data structures
,
interview
,
Programming
,
questions
,
sorting
Friday, January 7, 2011
Subscribe to:
Posts
(
Atom
)