Skip to content

Implementing algorithms in the book of "Introduction to Algorithms" 3rd ed

Notifications You must be signed in to change notification settings

hannah-jj/Intro-to-Algorithm-Exercises

Repository files navigation

Intro-to-Algorithm-Exercises

Implementing algorithms in the book of "Introduction to Algorithms" 3rd ed & various technical interview questions

Various Interview Questions Exercise

All exercies are written in javascript

Copy to console in your browser or node filename.js to see the codes running

  1. Chapter 2 : Insertion Sort & Merge Sort

  2. Greedy Algorithm : a. getMaxProfit(stockArray) : find the max profit given an array containing stock price from the day before

    b. getProductsOfAllIntsExceptAtIndex(intArray) : find the product of all numbers in the array except for the number at index

    c. findMaxProduct(intArray) : find the maxProduct from 3 numbers in a given array

    d. mergeTime(timeArray) : merge meeting time

  3. Recursion : a. class fib : utilizing memoization to save recursive runs b. ascii_distance(str1, str2) : utilize Levenshtein Distance algorithm to find ascii code differences between two strings

  4. Intersection: Finding Intersection between two rectangles

  5. Temperarture Tracker : track temperature, utilize class method to track min, max, mean & mode

  6. Binary Tree: a. superbalanced - difference between the depths of any two leaf nodes is no greater than one.

    b. binary search tree - check if a binary tree is a valide binary search tree

    c. find the 2nd largest element in a binary search tree.

    d. binary search - find integer in a sorted array

    e. binary search - find index of the rotating point in an array with words alphabetically sorted

  7. Trie: a. Optimize space to store URLs.

  8. Set: a. find two integers sum up to a number in an array of numbers

  9. Memoization: a. fibonacci three ways!

  10. Stack & Queue: a. optimize runtime for getMax() for a Stack b. construct a queue from two stacks c. finding closing parenthesis d. validate brackets/braces/parenthesis

  11. Prime Number: a. testing isPrime for every number b. find prime number using Sieve of Eratosthenes

  12. bit: a. find unique number or letter using bit wise calculation

  13. Linked List: a. fastest way to delete a node in a singly linked list given only the node.

    b. detect if a linked list has a cycle

    c. reverse a linked-list in place

    d. navigate to nth to the last node in a linked list

About

Implementing algorithms in the book of "Introduction to Algorithms" 3rd ed

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published