Skip to content

Commit bc2a354

Browse files
committed
more ads
1 parent 582f537 commit bc2a354

File tree

2 files changed

+20
-2
lines changed

2 files changed

+20
-2
lines changed

ads/concept/data_structure_tries.md ads/concept/data_structure_trees.md

+19-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
# :chart_with_upwards_trend: Data Structure : Tries Concepts
1+
# :chart_with_upwards_trend: Data Structure : Trees Concepts
22

33
##### Tries
44

@@ -344,3 +344,21 @@ It is a powerful data structure used in various string operations like pattern m
344344
- Uniqueness of Internal Nodes: Every internal node, other than the root, must have at least two children. This helps in the compression of the trie into a tree structure.
345345
- Leaf Labels: The leaves are often labeled with the start indices of the suffixes in the original string. This allows for efficient pattern matching and other operations.
346346
- Single String Representation: A Suffix Tree is typically built for a single input string. If used for multiple strings, a unique termination symbol must be appended to each string to ensure that no string is a prefix of another.
347+
348+
##### Fenwick Tree ~ Binary Indexed Tree ~ BIT
349+
350+
The *Fenwick Tree*, also known as *Binary Indexed Tree (BIT)*, is a data structure that provides efficient methods for performing prefix sums (cumulative sums) on an array of numbers.
351+
352+
It's especially beneficial for arrays that are frequently updated. The Fenwick Tree strikes a balance between the raw speed of array-based structures and the dynamic properties of tree-based structures. Its logarithmic operation time makes it a valuable tool for specific problems where both updates to the data and cumulative queries are frequent.
353+
354+
##### Fenwick Tree : Time Complexity
355+
356+
- *Query (Prefix Sum)*: `O(log n)`
357+
- *Update*: `O(log n)`
358+
359+
##### Fenwick Tree : Application
360+
361+
- *Dynamic Cumulative Sums*: If you need to maintain a dynamic list of numbers where you frequently update the numbers and query the cumulative sum, a Fenwick Tree offers a balance between update and query efficiency.
362+
- *Range Sum Queries*: With slight modifications, it can be used for range sum queries, where you want to find out the sum of numbers between any two indices quickly.
363+
- *Inversion Count in an Array*: Fenwick Tree can be employed to count the number of inversions in an array more efficiently than using a simple nested loop approach.
364+
- *Implementing Advanced Data Structures*: It can be used to implement more advanced data structures like order-statistic trees.

ads/concept/readme.md

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# :chart_with_upwards_trend: Concepts of Algorithms and Data Structures
22

33
- [Complexity and Amortized Analysis](./complexity_and_amortized_analysis.md.md)
4-
- [Data Structure: Tries](./data_structure_tries.md)
4+
- [Data Structure: Trees](./data_structure_trees.md)

0 commit comments

Comments
 (0)