akniloy6 / Data-Structures-and-Algorithms

Data structures and algorithms are vital elements in many computing applications. Processing data in an efficient manner helps to save space, computing power and time. In this repository, I'm trying to complete the book elements of programming interviews in python

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Data Structures and Algorithms

1. Primitives

  1. Computing the parity of a word
  2. Swap bits
  3. Reverse bits
  4. Find a closest integer with the same weight
  5. Compute x*y without arithmetical operators
  6. Compute x/y
  7. Compute x^y
  8. Reverse digits .
  9. Check if a decimal integer is a palindrome .
  10. Generate uniform random numbers
  11. Rectangle intersection

2. Arrays

  1. The Dutch national flag problem
  2. Increment an arbitrary-precision integer
  3. Multiply two arbitrary-precision integers
  4. Advancing through an array
  5. Delete duplicates from a sorted array .
  6. Buy and sell a stock once
  7. Buy and sell a stock twice
  8. Computing an altemation
  9. Enumerate all primes to n
  10. Permute the elements of an array .
  11. Compute the next permutation
  12. Sample offline data
  13. Sample online data
  14. Compute a random permutation
  15. Compute a random subset
  16. Generate nonuniform random numbers
  17. The Sudoku checker problem
  18. Compute the spiral ordering of a2D affay .
  19. Rotate a2D array
  20. Compute rows in Pascal's Triangle

3. Strings

  1. Interconvert strings and integers
  2. Base conversion
  3. Compute the spreadsheet column encoding .
  4. Replace and remove
  5. Test palindromicity
  6. Reverse all the words in a sentence
  7. Compute all mnemonics for a phone number
  8. The look-and-say problem
  9. Convert from Roman to decimal
  10. Compute all valid IP addresses
  11. Write a string sinusoidallY
  12. Implement run-length encoding
  13. Find the first occurrence of a substring

4. Linked Lists

  1. Merge two sorted lists
  2. Reverse a single sublist
  3. Test for cyclicity
  4. Test for overlapping lists-lists are cycle-free
  5. Test for overlapping lists-lists may have cycles
  6. Delete a node from a singly linked list
  7. Remove the kth last element from a list
  8. Remove duplicates from a sorted list
  9. Implement cyclic right shift for singly linked lists
  10. Implement even-odd merge
  11. Test whether a singly linked list is palindromic
  12. Implement list pivoting
  13. Add list-based integers

5. Stacks and Queues

  1. Implement a stack with max API
  2. Evaluate RPN expressions
  3. Test a string over "{,},(,),[,]" for well-formedness
  4. Normalize pathnames
  5. Compute buildings with a sunset view .
  6. Compute binary tree nodes in order of increasing depth
  7. Implement a circular queue
  8. Implement a queue using stacks
  9. Implement a queue with max API

6. BinaryTrees

  1. Test if a binary tree is height-balanced
  2. Test if a binary tree is symmetric
  3. Compute the lowest common ancestor in a binary tree .
  4. Compute the LCA when nodes have parent pointers
  5. Sum the root-to-leaf paths in a binary tree
  6. Find a root to leaf path with specified sum
  7. Implement an inorder traversal without recursion
  8. Implement a preorder traversal without recursion
  9. Compute the kth node in an inorder traversal
  10. Compute the successor
  11. Implement an inorder traversal with O(1) space .
  12. Reconstruct a binary tree from traversal data
  13. Reconstruct a binary tree from a preorder traversal with markers
  14. Form a linked list from the leaves of a binary tree .
  15. Compute the exterior of a binary tree .
  16. Compute the right sibling tree

7. Heaps

  1. Merge sorted files
  2. Sort an increasing-decreasing array
  3. Sort an almost-sorted array
  4. Compute the k closest stars
  5. Compute the median of online data
  6. Compute the k largest elements in a max-heap

8. Searching

  1. Search a sorted array for first occurrence ofk
  2. Search a sorted array for entry equal to its index
  3. Search a cyclically sorted array
  4. Compute the integer square root
  5. Compute the real square root
  6. Search in a 2D sorted affay
  7. Find the min and max simultaneously
  8. Find the kth largest element
  9. Find the missing IP address
  10. Find the duplicate and missing elements

9. Hash Tables

  1. Test for palindromic permutations
  2. Is an anonymous letter constructible?
  3. Implement an ISBN cache
  4. Compute the LCA, optimizing for close ancestors
  5. Find the nearest repeated entries in an array
  6. Find the smallest subarray covering all values
  7. Find smallest subarray sequentially covering all values
  8. Find the longest subarray with distinct entries
  9. Find the length of a longest contained interval
  10. Compute all string decompositions .
  11. Test the Collatz conjecture
  12. Implement a hash function for chess

10. Sorting

  1. Compute the intersection of two sorted arrays
  2. Merge two sorted arrays
  3. Remove first-name duplicates
  4. Smallestnonconstructiblevalue
  5. Render a calendar
  6. Merging intervals
  7. Compute the union of intervals
  8. Partitioning and sorting an affay with many rePeated entries
  9. Team photo day-1
  10. lmplement a fast sorting algorithm for lists
  11. Compute a salary threshold

11. Binary Search Trees

  1. Test if a binary tree satisfies the BST property . . . .
  2. Find the first key greater than a given value in a BST
  3. Find the k largest elements in a BST
  4. Compute the LCA in a BST
  5. Reconstruct a BST from traversal data
  6. Find the closest entries in three sorted arrays
  7. Enumerate numbers of the form a + b''12
  8. Build a minimum height BST from a sorted affay .
  9. Test if three BST nodes are totally ordered
  10. The range lookup problem
  11. Add credits

12. Recursion

  1. The Towers of Hanoi problem
  2. Generate all nonattacking placements of ,4-Queens
  3. Generatepermutations
  4. Generate the power set
  5. Generate all subsets of size k . . . .
  6. Generate strings of matched parens
  7. Generatepalindromicdecompositions
  8. Generate binary trees
  9. Implement a Sudoku solver
  10. Compute a Gray code

13. Dynamic Programming

  1. Count the number of score combinations
  2. Compute the Levenshtein distance
  3. Count the number of ways to traverse a2D array .
  4. Compute the binomial coefficients
  5. Search for a sequence in a 2D array
  6. The knapsack problem
  7. Thebedbathandbeyond.comproblem
  8. Find the minimum weight path in a triangle .
  9. Pick up coins for maximum gain
  10. Count the number of moves to climb stairs
  11. The pretty printing problem
  12. Find the longest nondecreasing subsequence

14. Greedy Algorithms and Invariants

  1. Compute an optimum assignment of tasks
  2. Schedule to minimize waiting time .
  3. The interval covering problem
  4. The 3-sum problem
  5. Find the majority element
  6. The gasup problem
  7. Compute the maximum water trapped by a pair of vertical lines .
  8. Compute the largest rectangle under the skyline

15. Graphs

  1. Search amaze
  2. Paint a Boolean matrix
  3. Compute enclosed regions . .
  4. Deadlockdetection
  5. Clone a graph
  6. Making wired connections
  7. Transform one string to another
  8. Team photo day-2

16. Parallel Computing

  1. Implement caching for a multithreaded dictionary
  2. Analyze two unslmchronized interleaved threads
  3. Implement synchronization for two interleaving threads
  4. Implement a thread pool .
  5. Deadlock
  6. The readers-writers problem
  7. The readers-writers problem with write preference .
  8. Implement a Timer class
  9. Test the Collatz conjecture in parallel

About

Data structures and algorithms are vital elements in many computing applications. Processing data in an efficient manner helps to save space, computing power and time. In this repository, I'm trying to complete the book elements of programming interviews in python


Languages

Language:Python 100.0%