SkillAgentSearch skills...

PrincetonAlgorithms

Python implementations of selected Princeton Java Algorithms and Clients by Robert Sedgewick and Kevin Wayne

Install / Use

/learn @dvklopfenstein/PrincetonAlgorithms
About this skill

Quality Score

0/100

Supported Platforms

Universal

README

Princeton University's "Algorithms and Clients"

by Robert Sedgewick, Kevin Wayne

Implemented in Python by DV Klopfenstein is selected code from:

Python implementations contain:

TESTS:

PREREQUISITES: python, numpy, pylab, math, sys, os.
NOTE: Most Python modules in this repository do not use pylab.

PYTHONPATH: Add the directory: <your_directory>/PrincetonAlgorithms/py/AlgsSedgewickWayne/

Download Princeton Algorithm's "Java Algorithms and Clients" from Kevin Wayne's github

Key:

  • P: Python implementation is present
Key  1 FUNDAMENTALS         Description                      DATA
:- --: :------------------- :-----------------------------   :-------------
 P   – BinarySearch         binary search                    tinyW.txt tinyT.txt largeW.txt largeT.txt
 .   – RandomSeq            random numbers in a given range  –
 .   – Average              average of a sequence of numbers –
 .   – Cat                  concatenate files                in1.txt in2.txt
 P   – Knuth                Knuth shuffle                    cards.txt
 .   – Counter              counter                          –
 .   – StaticSETofInts      set of integers                  –
 .   – Whitelist            whitelist client                 tinyW.txt tinyT.txt largeW.txt largeT.txt
 .   – Vector               Euclidean vector                 –
 P   – Date                 date                             –
 P   – Transaction          transaction                      –
 .   – Point2D              point                            –
 .   – Interval1D           1d interval                      –
 .   – Interval2D           2d interval                      –
 P 1.1 ResizingArrayStack   LIFO stack (resizing array)      tobe.txt
 . 1.2 LinkedStack          LIFO stack (linked list)         tobe.txt
 P   – Stack                LIFO stack                       tobe.txt
 P   – ResizingArrayQueue   FIFO queue (resizing array)      tobe.txt
 . 1.3 LinkedQueue          FIFO queue (linked list)         tobe.txt
 P   – Queue                FIFO queue                       tobe.txt
 .   – ResizingArrayBag     multiset (resizing array)        –
 . 1.4 LinkedBag            multiset (linked list)           –
 P   – Bag                  multiset                         –
 .   – Stopwatch            timer (wall time)                –
 .   – StopwatchCPU         timer (CPU time)                 –
 .   – LinearRegression     simple linear regression         –
 .   – PolynomialRegression polynomial regression            –
 P   – ThreeSum             brute-force three sum            1Kints.txt 2Kints.txt 4Kints.txt 8Kints.txt
 .   – ThreeSumFast         faster three sum                 1Kints.txt 2Kints.txt 4Kints.txt 8Kints.txt
 .   – DoublingTest         doubling test                    –
 .   – DoublingRatio        doubling ratio                   –
 P   – QuickFindUF          quick find                       tinyUF.txt mediumUF.txt largeUF.txt
 P   – QuickUnionUF         quick union                      tinyUF.txt mediumUF.txt largeUF.txt
 P 1.5 WeightedQuickUnionUF weighted quick union             tinyUF.txt mediumUF.txt largeUF.txt
 P   - WeightedQuickUnionUFPlus weighted quick union w/path compression        
 .   - UF                   union-by-rank with path halving  tinyUF.txt mediumUF.txt largeUF.txt


Key  2 SORTING     Description                       DATA
 - --: :---------- :-----------------------------    :-------------
 P 2.1 Insertion   insertion sort tiny.txt           words3.txt
 .   – InsertionX  optimized insertion               sort tiny.txt words3.txt
 P 2.2 Selection   selection sort                    –
 P 2.3 Shell       shellsort                         –
 P 2.4 Merge       top-down mergesort                –
 P   – MergeBU     bottom-up mergesort               –
 P   – MergeX      optimized mergesort               –
 P 2.5 Quick       quicksort                         –
 P   – Quick3way   quicksort with 3-way partitioning –
 P   – QuickX      optimized quicksort               –
 P   – TopM        priority queue client i           tinyBatch.txt
 P 2.6 MaxPQ       max heap priority queue           tinyPQ.txt
 .   – MinPQ       min heap priority queue           tinyPQ.txt
 .   – IndexMinPQ  index min heap priority queue     –
 .   – IndexMaxPQ  index max heap priority queue     –
 .   – Multiway    multiway merge                    m1.txt m2.txt m3.txt
 P 2.7 Heap        heapsort                          tiny.txt words3.txt


Key  3 SEARCHING              Description                  DATA
 - --: ---------------------- :--------------------------  :-------------
 .   – FrequencyCounter       frequency counter            tinyTale.txt tale.txt leipzig1M.txt
 P 3.1 SequentialSearchST     sequential search            tinyST.txt
 . 3.2 BinarySearchST         binary search                tinyST.txt
 . 3.3 BST binary             search tree                  tinyST.txt
 . 3.4 RedBlackBST red-black  tree                         tinyST.txt
 P 3.5 SeparateChainingHashST separate chaining hash table –
 P 3.6 LinearProbingHashST    linear probing hash table    –
 .   – ST                     ordered symbol table         –
 p   – SET                    ordered set                  –
 .   – DeDup                  remove duplicates            tinyTale.txt
 p   – WhiteFilter            whitelist filter             list.txt tinyTale.txt
 .   – BlackFilter            blacklist filter             list.txt tinyTale.txt
 p   – LookupCSV              dictionary lookup            ip.csv  DJIA.csv  amino.csv  UPC.csv
 .   – LookupIndex            index and inverted index     aminoI.csv movies.txt
 .   – FileIndex              file indexing                ex1.txt ex2.txt ex3.txt ex4.txt
 p   – SparseVector           sparse vector                –


Key   4 GRAPHS                    Description                         DATA
 - ---: :------------------------ :---------------------------------- :---------------------
 P    – Graph                     undirected graph                    tinyG.txt mediumG.txt
 .    – GraphGenerator            generate random graphs              –
 P  4.1 DepthFirstSearch          depth-first search in a graph       tinyG.txt mediumG.txt
 P  4.1 DepthFirstPaths           paths in a graph (DFS)              tinyCG.txt mediumG.txt largeG.txt
 P  4.2 BreadthFirstPaths         paths in a graph (BFS)              tinyCG.txt mediumG.txt largeG.txt
 .  4.3 CC                        connected components of a graph     tinyG.txt mediumG.txt largeG.txt
 .    – Bipartite                 bipartite or odd cycle              –
 .    – Cycle                     cycle in a graph                    tinyG.txt mediumG.txt largeG.txt
 .    – SymbolGraph               symbol graph                        routes.txt movies.txt
 .    – DegreesOfSeparation       degrees of separation               routes.txt movies.txt
 P    – Digraph                   directed graph                      tinyDG.txt
 .    – DigraphGenerator          generate random digraphs            –
 P  4.4 DirectedDFS               depth-first search in a digraph     tinyDG.txt
 p    – DepthFirstDirectedPaths   paths in a digraph (DFS)            tinyDG.txt mediumDG.txt
 .    – DirectedCycle             cycle in a digraph                  tinyDG.txt tinyDAG.txt
 .    – DepthFirstOrder           depth-first order in a digraph      tinyDG.txt tinyDAG.txt
 p  4.5 Topological               topological order in a DAG          jobs.txt
 .    – BreadthFirstDirectedPaths paths in a digraph (BFS)            tinyDG.txt mediumDG.txt
 .    – TransitiveClosure         transitive closure                  tinyDG.txt
 .    – SymbolDigraph             symbol digraph                      –
 p  4.6 KosarajuSharirSCC         strong components (Kosaraju-Sharir) tinyDG.txt mediumDG.txt largeDG.txt
 p    – TarjanSCC                 strong components (Tarjan)          tinyDG.txt mediumDG.txt largeDG.txt
 p    – GabowSCC                  strong components (Gabow)           tinyDG.txt mediumDG.txt largeDG.txt
 p    – EdgeWeightedGraph         edge-weighted graph                 –
 P    – Edge                      weighted edge                       –
 p    – LazyPrimMST               MST (lazy Prim)                     tinyEWG.txt mediumEWG.txt largeEWG.txt
 p  4.7 PrimMST            
View on GitHub
GitHub Stars169
CategoryDevelopment
Updated2mo ago
Forks53

Languages

Python

Security Score

100/100

Audited on Feb 1, 2026

No findings