Greedy algorithm
A greedy algorithm is an algorithm that follows the problem solving heuristic of making the locally optimal choice at each stage with the objective of finding a global optimum solution. A famous problem called "the traveling salesman problem" is solved by this technique. A greedy algorithm may not always produce the best solution. It is used in networking, signal analysis, and other fields that use graph theory.
Summary
A greedy algorithm is an algorithm that follows the problem solving heuristic of making the locally optimal choice at each stage with the objective of finding a global optimum solution. A famous problem called "the traveling salesman problem" is solved by this technique. A greedy algorithm may not always produce the best solution. It is used in networking, signal analysis, and other fields that use graph theory.
Things to Remember
- A greedy algorithm is an algorithm that follows the problem solving heuristic of making the locally optimal choice at each stage with the objective of finding a global optimum solution.
- A famous problem called "the traveling salesman problem" is solved by this technique.
- A greedy algorithm may not always produce the best solution.
- It is used in networking, signal analysis, and other fields that use graph theory.
MCQs
No MCQs found.
Subjective Questions
Q1:
Write a short note on Bupivacaine.
Type: Short Difficulty: Easy
<p><strong>Introduction:</strong></p>
<p>It is an amide which is a structural homologue of mepivacaine. It has a long duration of action. It is especially used as a dental anaesthetic. The onset of action is about2-10 minutes and remains acting up to 7 hours.</p>
<p>The onset of action is 4 to 7minutes following the administration of 0.25% or 0.5% of solutions in an epidural, including caudal block and peripheral or sympathetic nerve block. The duration of action ranges from 4-7 hours.</p>
<p><strong>Mechanism of action:</strong></p>
<p>It blocks the generation and conduction of nerves impulses. The progression of anaesthesia is related to the diameter, myelination & conduction velocity of affected nerve fibers, with the order of loss of function being as follows:</p>
<ul>
<li>Temperature</li>
<li>Proprioception</li>
<li>Skeletal muscle tone</li>
</ul>
<p>Toxic levels may depress conduction in cardiac muscle, excitability and cause AV block, ventricular arrhythmias, and cardiac arrest. The order of loose of a function is as follows: pain, temperature, touch, and skeletal muscle relaxation.</p>
<p><strong>Indication:</strong></p>
<ul>
<li>Local infiltration</li>
<li>Peripheral nerve block</li>
<li>Epidural block</li>
<li>Spinal anaesthesia</li>
<li>Brachial plexus block</li>
<li>Post surgical and chronic pain relief</li>
</ul>
<p> <strong>Preparation:</strong></p>
<p>It is usually available in the form of injection such as:</p>
<p>Bupivacaine injection 0.25%, 0.5%, 1%</p>
<p><strong>Dose:</strong></p>
<p>Spinal anesthesia: 20-40mg (2-4)</p>
<p>Epidural block, surgery, lumbar: max.30ml</p>
<p><strong>Adverse effect:</strong></p>
<ul>
<li>CVS: bradycardia, hypotension</li>
<li>CNS: anxiety, dizziness, tremor</li>
<li>Respiratory: respiratory arrest, status asthmaticus</li>
<li>Miscellaneous: hypersensitivity</li>
</ul>
<p><strong>Drug interaction:</strong></p>
<p>The failure rate of spinal anaesthesia with Bupivacaine is markedly increased in patients who are receiving antirheumatic drug and who drink.</p>
<p><strong>Contraindication:</strong></p>
<ul>
<li>Hypersensitivity</li>
<li>Severe shock</li>
<li>Myasthenia gravis</li>
</ul>
<p><strong>General implication:</strong></p>
<ul>
<li>Check ABC</li>
<li>Check BP, ECG</li>
<li>Check the depth of anaesthesia</li>
<li>Check fluid status</li>
<li>To reassure the patient</li>
<li>To find out if they have any problems like discomfort, nausea etc</li>
<li>Monitor about complications like high block, hypotension, bradycardia, poor spinal block, breaks through pain, total spinal etc.</li>
<li>Monitor post-operative complications like urinary retention, post-spinal headache.</li>
<li>A solution containing preservatives is not better for a spinal epidural and caudal block.</li>
<li>It should not inject in IM or IV.</li>
<li>Do not give to hypersensitivity patients.</li>
</ul>
<p> </p>
Videos
No videos found.

Greedy algorithm
A greedy algorithm is an algorithm that follows the problem solving heuristic(a technique designed for solving more quickly when classic methods are too slow, or for finding an approximate solution when classic methods fail to find any exact solution) of making the locally optimal choice at each stage with the objective of finding a global optimum solution. In many problems, a greedy strategy does not in general produce an optimal solution, but nonetheless may yield locally optimal solutions that approximate a global optimal solution in a reasonable time.
For example, a greedy strategy for the traveling salesman problem is the following heuristic: "At each stage, visit an unvisited city nearest to the current city". This heuristic need not find the best solution, but it makes sure that it terminates in a reasonable number of steps.
In general, greedy algorithms have the following five components:
- A candidate set, from which a solution is created
- A selection function, which chooses the best candidate to be added to the solution
- A feasibility function, that is used to determine if a candidate can be used to contribute to a solution
- An objective function, which assigns a value to a solution, or a partial solution, and
- A solution function, which will indicate when we have discovered a complete solution
A case shown below is the problem involving reaching the largest-sum. The greedy algorithm used in this case fails to produce the desired output.

With a goal of reaching the largest sum, at each step, the greedy algorithm will choose the immediate largest, so it will choose 12 instead of 3 at the second step, and will not reach the best solution, which contains 99.
Applications
- Finding minimum spanning trees (eg: Kruskal Algorithm, Prim's Algorithm)
- Network routing
- Huffman encoding
- Decision tree learning
- Signal approximation
References
1. https://en.wikipedia.org/wiki/Greedy_algorithm
2. Karumanchi, N. "Data Structures and Algorithms Made Easy"
3. Y. Langsam, M. J. Augenstein and A. M Tenenbaum, “Data Structures using C and C++”
4. R. L. Kruse, B. P. Leung, C. L. Tondo, “Data Structure and Program design in C”
Lesson
Graphs
Subject
Computer Engineering
Grade
Engineering
Recent Notes
No recent notes.
Related Notes
No related notes.