Skip to content

Commit

Permalink
updates
Browse files Browse the repository at this point in the history
Signed-off-by: Raj Patil <rajp152k@gmail.com>
  • Loading branch information
rajp152k committed Jan 25, 2025
1 parent 639abb4 commit 0435ffe
Show file tree
Hide file tree
Showing 12 changed files with 133 additions and 33 deletions.
2 changes: 1 addition & 1 deletion Content/20230720113957-graphs.org
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ A mathematical protocal used to represent suitable abstractions using nodes and
- captures the notion of a collection of components that communicate/relay certain entities via connections with each other.
- computer networks are an immediate obvious examples.
** Schedule Generation for Distributed [[id:8afb9d29-252b-4f17-ad42-700444fe4464][Processes]]
- when trying to parallelize computations with dependents from several components, one can model the computation sites and temporal dependency links as a [[id:d07976cd-5194-484e-82ab-8c55e064eeb1][Directed Acyclic Graph]] and apply [[id:78d16b5e-1893-4057-bc22-b2c9a3ca7ed6][Topological Sort]] to generate computation schedules.
- when trying to parallelize computations with dependents from several components, one can model the computation sites and temporal dependency links as a [[id:d07976cd-5194-484e-82ab-8c55e064eeb1][Directed Acyclic Graph]] and apply [[id:a266afcb-0813-4a40-8dcb-cfa7b8bd1a8b][Topological Sort]] to generate computation schedules.
- checkout [[id:c307ed4a-77d8-4f69-8995-94c9da4c0768][Parallelism]] for a more fundamental treatment of the above.

** [[id:a96b0e92-16c9-4a8c-863d-f0303efd0fa2][Entity Relation Diagrams]]
18 changes: 0 additions & 18 deletions Content/20231214112744-sort.org

This file was deleted.

15 changes: 15 additions & 0 deletions Content/20240205171209-go.org
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,21 @@
#+title: Golang
#+filetags: :golang:

* Org Babel Base
#+begin_src go
import (
"fmt"
)

func main(){
fmt.Println("org babel base")
return
}
#+end_src

#+RESULTS:
: org babel base

* Stream
** 0x22B2
- post theGoPL, will finish of TDD with Go
Expand Down
11 changes: 3 additions & 8 deletions Content/20241115141751-recursion.org
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,6 @@
- This is the part of the function that includes a call to itself.
- It reduces the problem at each step, bringing it closer to the base case.

- *Applications*:
- Used in algorithms for traversing data structures like trees and graphs (e.g., depth-first search).
- Useful in problems that can be divided into similar sub-problems, like divide and conquer algorithms (e.g., mergesort, quicksort).

*Connections*:
- Recursion is a fundamental concept in computer science closely related to [[id:120cade5-1cf0-4afe-b541-e2b607ae77da][mathematical induction]], as both involve solving problems by breaking them down into base cases and smaller sub-problems.
- Recursion is frequently compared to [[id:40722d92-1d10-445e-bcd9-f41999ccdf52][iteration]], as both can be used to repeat tasks but have different trade-offs in terms of complexity and efficiency.

* Interconverting Recursion and [[id:40722d92-1d10-445e-bcd9-f41999ccdf52][Iteration]]
** Steps for Interconverting Recursion to Iteration:

Expand Down Expand Up @@ -61,3 +53,6 @@
* Relevant Nodes
- [[id:3a717d24-64ef-4d38-936a-6814baaa1e6a][Tail Recursion]]
- [[id:1bdc93aa-b564-4520-8590-c1ffcb026f55][Memoization]]

* [[id:8e9f6cef-da57-48ed-b86d-029f1b528615][Time Complexity]] of a Recursive Function
- checkout [[id:97440bc5-79a0-4140-9066-8a95ac747fd9][Master Theorem]]
28 changes: 28 additions & 0 deletions Content/20241120151833-binary_tree.org
Original file line number Diff line number Diff line change
Expand Up @@ -3,3 +3,31 @@
:END:
#+title: Binary Tree
#+filetags: :data:programming:

* Overview

- *Definition*: A binary tree is a hierarchical data structure in which each node has at most two children, referred to as the left child and the right child.

- *Types of Binary Trees*:
- *Full Binary Tree*: Every node other than the leaves has two children.
- *Complete Binary Tree*: All levels are fully filled except possibly for the last level, which is filled from left to right.
- *Perfect Binary Tree*: All interior nodes have two children and all leaves are at the same level.
- *Balanced Binary Tree*: Height difference between left and right subtrees of any node is at most one.
- *Binary Search Tree (BST)*: A binary tree in which the left child contains nodes with values less than the parent node, and the right child contains nodes with values greater than the parent.

- *Key Properties*:
- Maximum number of nodes at level \( l \): \( 2^l \)
- Maximum number of nodes in a binary tree of height \( h \): \( 2^{(h+1)} - 1 \)
- Minimum height of a tree with \( n \) nodes: \( \lfloor \log_2(n) \rfloor \)

- *Traversal Methods*:
- *In-order*: Left, Root, Right
- *Pre-order*: Root, Left, Right
- *Post-order*: Left, Right, Root
- *Level-order*: Visiting nodes level by level from top to bottom

- *Common Operations*:
- Insertion
- Deletion
- Searching for a value
- Height and Depth calculation
13 changes: 13 additions & 0 deletions Content/20250121122605-time_complexity.org
Original file line number Diff line number Diff line change
Expand Up @@ -31,3 +31,16 @@
- How do different data structures (arrays, linked lists, trees) impact time complexity?
- In what scenarios do average case complexities differ significantly from worst-case analyses?
- What are the implications of time complexity in real-time systems versus batch processing systems?


* Complexity Bounds

- Upper Bound: This is represented as Big O notation (e.g., O(n)), indicating the maximum amount of time an algorithm may take to complete.

- Lower Bound: Represented as Big Omega notation (e.g., Ω(n)), which indicates the minimum time necessary for a given algorithm for every input size.

- Tight Bound: Denoted as Big Theta notation (e.g., Θ(n)), which describes both the upper and lower bounds of an algorithm, providing an accurate characterization of performance.

- [[id:b91e378d-b17a-43b2-b13e-19c02afe1558][Amortized Complexity]]: Average case over a sequence of operations. It is useful for data structures that may have occasional expensive operations (e.g., dynamic array resizing).

- [[id:95edc4bc-c364-4b18-833a-ba476b3283e8][Recursive Algorithms]]: Time complexities for recursive algorithms often derive from the [[id:97440bc5-79a0-4140-9066-8a95ac747fd9][Master Theorem]] or recurrence relations to determine their performance characteristics.
13 changes: 7 additions & 6 deletions Content/20250122093005-algoindex.org
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,10 @@

Index into algorithms of varying complexities with a brief description of what they achieve

| Algorithm | Desc |
|----------------+-------------------------------------|
| [[id:d4fe54f3-65c0-4a8a-9075-242ce475e706][EdgeRank]] | Facebook's NewsFeed Aggregation |
| [[id:514705de-abe8-4781-9c51-03c318bbe077][PageRank]] | Google's Web Page Ranker for Search |
| [[id:327ebe76-4fd6-47d4-b053-94e380937c6d][Raft Consensus]] | generic distributed peer protocol |
| | |
| Algorithm | Desc |
|------------------+---------------------------------------|
| [[id:d4fe54f3-65c0-4a8a-9075-242ce475e706][EdgeRank]] | Facebook's NewsFeed Aggregation |
| [[id:514705de-abe8-4781-9c51-03c318bbe077][PageRank]] | Google's Web Page Ranker for Search |
| [[id:327ebe76-4fd6-47d4-b053-94e380937c6d][Raft Consensus]] | generic distributed peer protocol |
| [[id:c83b6ceb-d7d4-4fa4-aa54-97cb9a761a05][Sorting]] | Index into Generic Sorting Algorithms |
| [[id:a266afcb-0813-4a40-8dcb-cfa7b8bd1a8b][Topological Sort]] | Sorting [[id:d07976cd-5194-484e-82ab-8c55e064eeb1][Directed Acyclic Graph]]s |
5 changes: 5 additions & 0 deletions Content/20250124131531-amortization.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:PROPERTIES:
:ID: b91e378d-b17a-43b2-b13e-19c02afe1558
:END:
#+title: Amortization
#+filetags: :algo:cs:
10 changes: 10 additions & 0 deletions Content/20250124131606-master_theorem.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
:PROPERTIES:
:ID: 97440bc5-79a0-4140-9066-8a95ac747fd9
:END:
#+title: Master Theorem
#+filetags: :cs:algo:

See [[id:8e9f6cef-da57-48ed-b86d-029f1b528615][Time Complexity]]

* Resources
- https://en.wikipedia.org/wiki/Master_theorem_(analysis_of_algorithms)
33 changes: 33 additions & 0 deletions Content/20250125150451-sorting_algos.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
:PROPERTIES:
:ID: c83b6ceb-d7d4-4fa4-aa54-97cb9a761a05
:END:
#+title: Sorting
#+filetags: :algo:cs:

* Overview
- *Definition*: Sorting is the process of arranging data or elements in a particular order, typically in ascending or descending sequence.

- *Types of Sorting Algorithms*:
- Comparison-based sorting (e.g., Quick Sort, Merge Sort)
- Non-comparison-based sorting (e.g., Counting Sort, Radix Sort)

- *Complexity Classes*:
- *[[id:8e9f6cef-da57-48ed-b86d-029f1b528615][Time Complexity]]*: Measures the time taken to sort based on the number of elements.
- Best, Average, and Worst case scenarios
- *[[id:4a1f8e43-8c10-4187-8311-0b8df074b05d][Space Complexity]]*: Refers to the amount of memory space required by the algorithm.

- *Stability*: Some sorting algorithms maintain the relative order of records with equal keys (e.g., Merge Sort), while others do not (e.g., Quick Sort).

- *In-Place Sorting*: Sorting algorithms that do not require additional storage for a new array (e.g., Heap Sort).

* Types Overview
** Comparison-based
- *Bubble Sort*: Simple algorithm that repeatedly steps through the list, compares adjacent elements, and swaps them if they are in the wrong order.
- *Selection Sort*: Divides the input list into a sorted and an unsorted region and repeatedly selects the smallest (or largest) element from the unsorted region to move it to the sorted region.
- *[[id:c70dbfb7-1556-47d6-a590-c438e9662d91][Insertion Sort]]*: Builds a sorted array one element at a time by repeatedly picking the next element from the unsorted region and inserting it into the correct position in the sorted region.
- *Merge Sort*: Divides the list into two halves, recursively sorts them, and merges the sorted halves.
- *Quick Sort*: Selects a 'pivot' element, partitions the array into elements less than and greater than the pivot, and recursively sorts the partitions.
** Non-Comparison-based
- *Counting Sort*: Counts the occurrences of each unique element and calculates the position of each element in the output array.
- *Radix Sort*: Processes the input numbers digit by digit, starting from the least significant digit to the most significant.
- *Bucket Sort*: Distributes elements into a number of buckets and sorts these buckets individually, then concatenates them.
5 changes: 5 additions & 0 deletions Content/20250125151036-topological_sort.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
:PROPERTIES:
:ID: a266afcb-0813-4a40-8dcb-cfa7b8bd1a8b
:END:
#+title: Topological Sort
#+filetags: :algo:cs:
13 changes: 13 additions & 0 deletions Content/20250125151342-insertion_sort.org
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
:PROPERTIES:
:ID: c70dbfb7-1556-47d6-a590-c438e9662d91
:END:
#+title: Insertion Sort
#+filetags: :algo:cs:

#+begin_src go

func

#+end_src

#+RESULTS:

0 comments on commit 0435ffe

Please sign in to comment.