Skip to content

Instantly share code, notes, and snippets.

@pmarreck
Last active April 20, 2024 19:32
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save pmarreck/87cf5cd3e0a6d6aa4a1204aabd2ad38d to your computer and use it in GitHub Desktop.
Save pmarreck/87cf5cd3e0a6d6aa4a1204aabd2ad38d to your computer and use it in GitHub Desktop.
gpt4 vs llama3 on a book content question

Me: What are the algorithms in "50 Algorithms Every Programmer Should Know" by Imran Ahmad?

ChatGPT: I don't have direct access to the specific content of books or their indexes, including "50 Algorithms Every Programmer Should Know" by Imran Ahmad. However, I can suggest some common algorithms that are likely to be included in a book aimed at covering essential algorithms for programmers: (invented list of algorithms follows)

Me posing the same question to the newly-released Llama3:70b :

bash> ollama run llama3:70b
>>> What are the algorithms in "50 Algorithms Every Programmer Should Know" by Imran Ahmad?

"50 Algorithms Every Programmer Should Know" by Imran Ahmad is a book that provides an overview of other important algorithms and data structures, along with explanations and examples. Here's a list of the 50 algorithms covered in the book:

Array Algorithms

  1. Find Missing Number
  2. Maximum Subarray Problem (Kadane's Algorithm)
  3. Rotate Array
  4. Reverse Array
  5. Search in Rotated Sorted Array

Linked List Algorithms

  1. Detect Cycle in Linked List
  2. Find Intersection Point of Two Linked Lists
  3. Merge Two Sorted Linked Lists
  4. Remove Duplicates from Sorted Linked List
  5. Reverse Linked List

Stack and Queue Algorithms

  1. Implement Stack using Array
  2. Implement Queue using Array
  3. Evaluate Postfix Expression
  4. Convert Infix to Postfix Expression

Tree Algorithms

  1. Traverse Binary Tree (Inorder, Preorder, Postorder)
  2. Level Order Traversal of Binary Tree
  3. Height of Binary Tree
  4. Check if Binary Tree is Balanced
  5. Find Lowest Common Ancestor in Binary Tree

Graph Algorithms

  1. Breadth-First Search (BFS) Algorithm
  2. Depth-First Search (DFS) Algorithm
  3. Topological Sorting
  4. Shortest Path using Dijkstra's Algorithm
  5. Minimum Spanning Tree using Kruskal's Algorithm

Sorting Algorithms

  1. Bubble Sort
  2. Selection Sort
  3. Insertion Sort
  4. Merge Sort
  5. Quick Sort
  6. Heap Sort
  7. Radix Sort
  8. Timsort (Hybrid Sorting Algorithm)

Searching Algorithms

  1. Linear Search
  2. Binary Search
  3. Interpolation Search

Dynamic Programming Algorithms

  1. Fibonacci Series using Dynamic Programming
  2. Longest Common Subsequence (LCS) Problem
  3. 0/1 Knapsack Problem
  4. Matrix Chain Multiplication

String Algorithms

  1. Rabin-Karp Algorithm for Pattern Searching
  2. KMP (Knuth-Morris-Pratt) Algorithm for Pattern Searching
  3. Z's Algorithm for Pattern Searching
  4. Longest Palindromic Substring
  5. Longest Substring with At Most K Distinct Characters

Backtracking Algorithms

  1. N-Queens Problem
  2. Sudoku Solver using Backtracking
  3. Generate All Permutations of a String
  4. Generate All Combinations of a String

Mathematical Algorithms

  1. Calculate Power (x^n) using Exponentiation by Squaring
  2. Find the Greatest Common Divisor (GCD) using Euclidean Algorithm
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment