[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"detail-sidebar-cat-0-en-105":3,"doc-seo-670583-105":59,"doc-detail-670583-en":130,"doc-similar-670583":161},{"code":4,"msg":5,"data":6},0,"success",[7,13,18,23,28,33,38,43,48,51,55],{"id":8,"doc_module":4,"doc_module_name":9,"category_name":10,"show_sort_weight":11,"slug":12},1,"Document","Story & Novel",90,"story-novel",{"id":14,"doc_module":4,"doc_module_name":9,"category_name":15,"show_sort_weight":16,"slug":17},2,"Literature",80,"literature",{"id":19,"doc_module":4,"doc_module_name":9,"category_name":20,"show_sort_weight":21,"slug":22},4,"Exam",70,"exam",{"id":24,"doc_module":4,"doc_module_name":9,"category_name":25,"show_sort_weight":26,"slug":27},5,"Comic",60,"comic",{"id":29,"doc_module":4,"doc_module_name":9,"category_name":30,"show_sort_weight":31,"slug":32},6,"Technology",50,"technology",{"id":34,"doc_module":4,"doc_module_name":9,"category_name":35,"show_sort_weight":36,"slug":37},7,"Healthcare",40,"healthcare",{"id":39,"doc_module":4,"doc_module_name":9,"category_name":40,"show_sort_weight":41,"slug":42},8,"Research & Report",30,"research-report",{"id":44,"doc_module":4,"doc_module_name":9,"category_name":45,"show_sort_weight":46,"slug":47},9,"Religion & Spirituality",20,"religion-spirituality",{"id":46,"doc_module":4,"doc_module_name":9,"category_name":49,"show_sort_weight":46,"slug":50},"World Cup","world-cup",{"id":52,"doc_module":4,"doc_module_name":9,"category_name":53,"show_sort_weight":52,"slug":54},10,"Lifestyle","lifestyle",{"id":56,"doc_module":4,"doc_module_name":9,"category_name":57,"show_sort_weight":24,"slug":58},19,"General","general",{"code":4,"msg":60,"data":61},"ok",{"site_id":62,"language":63,"slug":64,"title":65,"keywords":66,"description":67,"schema_data":68,"social_meta":123,"head_meta":125,"extra_data":127,"updated_unix":129},105,"en","cs-251-data-structures-and-algorithms-big-o-and-classic-data-structures-sorting","CS 251 - Data Structures and Algorithms - Big-O and Classic Data Structures & Sorting","","CS 251 lecture notes summarize time and space analysis foundations and connect Big-O, Big-Ω, and Big-Θ definitions to practical data-structure performance. The content covers arrays, binary trees (full, complete, balanced), binary heaps (heap operations, heapify, heap sort), quick sort behavior under best and worst cases, and multiple sorting methods including counting, bucket, and radix sort. It also details hashing via polynomial rolling and division/multiplication methods, collision handling with chaining and open addressing, rehashing rules, and fundamentals of B-trees, red-black trees, and graph concepts (paths, cycles, and edge representations).",{"@graph":69,"@context":122},[70,84,105],{"@type":71,"itemListElement":72},"BreadcrumbList",[73,77,79,82],{"item":74,"name":75,"@type":76,"position":8},"https://docshare.wps.com","Home","ListItem",{"item":78,"name":9,"@type":76,"position":14},"https://docshare.wps.com/document/",{"item":80,"name":40,"@type":76,"position":81},"https://docshare.wps.com/document/research-report/",3,{"item":83,"name":65,"@type":76,"position":19},"https://docshare.wps.com/document/cs-251-data-structures-and-algorithms-big-o-and-classic-data-structures-sorting/670583/",{"url":83,"name":65,"@type":85,"image":86,"author":91,"headline":65,"publisher":94,"fileFormat":97,"inLanguage":63,"description":67,"dateModified":98,"datePublished":99,"encodingFormat":97,"isAccessibleForFree":100,"interactionStatistic":101},"DigitalDocument",{"url":87,"@type":88,"width":89,"height":90},"https://docshare.wps.com/thumbnails/cs-251-data-structures-and-algorithms-big-o-and-classic-data-structures-sorting/670583.png","ImageObject",300,407,{"name":92,"@type":93},"Well Done","Person",{"url":74,"name":95,"@type":96},"DocShare","Organization","application/pdf","2026-11-09","2026-11-01",true,{"@type":102,"interactionType":103,"userInteractionCount":14},"InteractionCounter",{"@type":104},"ViewAction",{"@type":106,"mainEntity":107},"FAQPage",[108,114,118],{"name":109,"@type":110,"acceptedAnswer":111},"How are Big-O, Big-Ω, and Big-Θ defined in these notes?","Question",{"text":112,"@type":113},"Big-O describes an upper bound using constants c and n0 such that 0 ≤ f(n) ≤ c·g(n) for all n ≥ n0. Big-Ω states a lower bound f(n) ≥ c·g(n). Big-Θ requires both upper and lower bounds so f(n) grows proportionally to g(n).","Answer",{"name":115,"@type":110,"acceptedAnswer":116},"What are the key performance guarantees for balanced binary trees and heap operations?",{"text":117,"@type":113},"For balanced binary trees, the height h satisfies h ∈ O(log(n)), and balanced insert/search/delete operations run in O(log(n)). For binary heaps, the height is Θ(log(n), so insertions and deletions take O(log(n)) via a single path, while heapify runs in O(n).",{"name":119,"@type":110,"acceptedAnswer":120},"Which sorting algorithms are covered, and what is the main tradeoff for each?",{"text":121,"@type":113},"Counting sort converts the input to a frequency array, produces results using cumulative counts, and runs in O(n+k) with extra dependence on the max value k. Bucket sort analyzes best, worst, and average behavior based on bucket distribution and includes additional sorting inside buckets. Radix sort performs digit-wise passes using stable sorting (e.g., counting sort), with runtime O(d(n+k)) and space O(n+k).","https://schema.org",{"og:url":83,"og:type":124,"og:title":65,"og:site_name":95,"og:description":67},"article",{"robots":126,"canonical":83},"index,follow",{"doc_id":128,"site_id":62},670583,1793570142,{"code":4,"msg":5,"data":131},{"doc_id":128,"user_id":132,"nickname":92,"user_avatar":133,"doc_module":4,"category_id":39,"category_name":40,"doc_title":65,"doc_description":67,"doc_content":134,"file_id":135,"file_url":136,"file_type":137,"file_size":138,"view_count":14,"is_deleted":4,"is_public":8,"is_downloadable":8,"audit_status":8,"page_count":29,"language":139,"language_code":63,"site_id":62,"html_lang":63,"table_of_contents":140,"faqs":141,"seo_title":142,"seo_description":67,"update_tm":129,"read_time":143,"preview_page_count":19,"preview_urls":144},5909892210082,"https://ap-avatar.wpscdn.com/avatar/56001069da27c9f41e8?x-image-process=image/resize,m_fixed,w_180,h_180&k=1789614185077863061","CS 251: Data Structures and Algorithms  \nFigure 1: Formulas Big-O  \nBig-O: f (n) ∈ O􀀀g(n)􀀁 ⇐⇒  \n∃ c > 0 , ∃ n0 > 0 : ∀n ≥ n0 , 0 ≤ f (n) ≤ cg (n) .  \nBig-Ω : f (n) ∈ Ω(g(n)),  \n0 ≤ c · g(n) ≤ f (n) Big-Θ : f (n) ∈ Θ(g(n)),  \n0 ≤ c 1 · g(n) ≤ f (n) ≤ c2 · g(n)  \nFigure 2: Big-O curve  \nArrays  \nAccess: Θ(1), Insert: Θ(1) (with tail) Θ(n) (no tail) .  \nResize and space of resize: Θ(n)  \nBinary trees  \nMax nodes in BT (total in complete BT) = 2h+1 − 1. Leave nodes = 2h  \nFigure 3: Full BT and Complete BT  \n→ Full BT: Each node has none or two children.  \n→ Complete BT: All levels full until last (left to right) .  \nBalanced BT: At every node the height of the left and right subtree differs by at most 1:  \n2h ≤ n → h ≤ log2 n ∴ h ∈ O(log(n)), where n is the number of nodes.  \nBalanced BT Insertions, Searches & Deletions: O(log(n))  \nBinary Heap  \nComplete binary tree ∴ h ∈ Θ(log(n)) .  \nInsertions & Deletions: O(log(n)) through single path.→ Left: 2i + 1, Right: 2i + 2 .  \n→ Parent: 􀀄 ~~i ~~−21 􀀅 .  \nMax heap (max on top) . Min heap (min on top) .  \nInsertions enter in complete BT order and then adjust ( sift up) .  \nSingle insert is O log(n) ∴ n inserts ∈ O (n log(n))  \nHeapify  \nSift down on all nodes in an array from [0 , 􀀄 ~~n~~2􀀅 − 1] Heap build: O (n)  \nHeap sort  \nCall Heapify (O(n)) and then swap the root with the last item and fix the heap (\"lock\" the last element after swap) .  \nFigure 4: Heap sort example  \nQuick sort  \nNot stable and pivot selection is arbitrary.  \nBest case (O(n log(n)))→ even partitions.  \nWorst case (O(n2 ))→ one partition has n − 1 elements.  \nFigure 5: Quick sort; i (return) is moved when comparison is lower and swaps at j (comparison index)  \nCounting sort decision tree  \nLeaves are n! permutations of the array (all possibilities) . Internal nodes are the conditional checks.  \nAs full BT will be 2h leaves ∴ 2h ≥ n!  \nh ≥ log2 n! ⇒ h ≥ n log2 n ∴ h ∈ O (n log(n))  \nCounting sort  \nArray → Freq. array → Cm. frq. array → Resulting array filled from cm. frq. array backwards.  \nStable, bad with large max value of an array.  \nRuntime & Space: O (n + k), where n: array size; k: max value of array (freq. arr.) .  \nBucket sort  \nWorst case O (n2 ) → unsorted un-uniform distribution.  \nBest case O (n) → one element per bucket or all sorted in one bucket.  \nAvg. case O (n + ~~n~~k2 + k)  \nIf there is one key per bucket (i.e. there exists a bucket for any key) then, O (n + k), where n: elements in array; k: buckets.  \nExtra work comes from sorting within each bucket.  \nBetter for uniform distributions: fits things equally.  \nRadix sort  \nSorting through LSD to MSD using a stable sorting algorithm (e.g. counting sort) .  \nRuntime: O (d(n +k)), where d: digits; n +k: counting sort.  \nSpace: O (n + k)  \nUsing bucket sort with binary digits, create 2 buckets for 2 keys (1 and 0) .  \nIf there are constant lengths of digits then O (n) is possible.  \nE.g. O (d(n + 2)) ∈ O (n) if there are constant lenths of binary numbers.  \nPolynomial rolling hash  \nWhere S: string of length m ; a: multiplier for polynomial.  \nm−1  \nH (S, a) = s0 am−1 + s1 am−2 + ... + sm−1a0 = X siam−i−1  \ni=0  \nIf using a fixed sized window m then do rolling updates on S: H1 = (H0 − sold · am−old ) × a + snew  \nHashing functions  \nDivision method: h (k) = k mod m (avoid 2P and 10P = m), where m: size of hash table.  \nMultiplication method: h (k) = ⌊m(kA mod m)⌋ (A ≈√52−1 ; m is not critical)  \nAim to have keys be distributed uniformly (no clusters) .  \nCollision strategies  \nUnder the Simple Uniform Hashing Assumption  \n→ Average number of keys per bucket (Load Factor): α = ~~n~~m → n ∈ O (m) ∴ α ∈ O(1), n: keys, m: buckets.  \nChaining  \nFigure 6: Chaining collision management  \nWorst case O (n): traversing all items in the table. Runtime Θ(1 + LengthOfChain) = Θ(1 + ~~n~~m) .  \nOpen addressing  \nProbing sequence for h(k, i) ⇒ h (k, 0), h(k, 1), ..., h (k, m−1)→ Linear: h (k, i) = (h(k) + i) mod m.  \n→ Quadratic: h (k, i) = (h(k) + c1 i + c2 i2 ","cbCaiju2mRKoqBXp","https://ap.wps.com/l/cbCaiju2mRKoqBXp","pdf",12672832,"English","# Big-O, Big-Ω, and Big-Θ\n## Arrays and Access Costs\n## Binary Trees: Full, Complete, Balanced\n# Binary Heap and Heap Operations\n## Heapify and Heap Sort\n# Quick Sort and Counting Sort\n# Bucket Sort and Radix Sort\n# Hashing and Collision Resolution\n## Chaining and Open Addressing\n## Rehashing Rules\n# B-trees and Red-Black Trees\n# Graph Basics: Undirected Graphs and Paths","[{\"question\":\"How are Big-O, Big-Ω, and Big-Θ defined in these notes?\",\"answer\":\"Big-O describes an upper bound using constants c and n0 such that 0 ≤ f(n) ≤ c·g(n) for all n ≥ n0. Big-Ω states a lower bound f(n) ≥ c·g(n). Big-Θ requires both upper and lower bounds so f(n) grows proportionally to g(n).\"},{\"question\":\"What are the key performance guarantees for balanced binary trees and heap operations?\",\"answer\":\"For balanced binary trees, the height h satisfies h ∈ O(log(n)), and balanced insert/search/delete operations run in O(log(n)). For binary heaps, the height is Θ(log(n), so insertions and deletions take O(log(n)) via a single path, while heapify runs in O(n).\"},{\"question\":\"Which sorting algorithms are covered, and what is the main tradeoff for each?\",\"answer\":\"Counting sort converts the input to a frequency array, produces results using cumulative counts, and runs in O(n+k) with extra dependence on the max value k. Bucket sort analyzes best, worst, and average behavior based on bucket distribution and includes additional sorting inside buckets. Radix sort performs digit-wise passes using stable sorting (e.g., counting sort), with runtime O(d(n+k)) and space O(n+k).\"}]","CS 251 - Data Structures and Algorithms - Big-O and Classic Data Structures & Sorting | PDF",15,[145,149,153,157],{"page_no":8,"url":146,"width":147,"height":148},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/59b1dee15a3af6c6b0417ba3b2ce796c.webp",983,1272,{"page_no":14,"url":150,"width":151,"height":152},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/de1aa5b3ecde8e4d705af0cbb3613fc4.webp",982,1270,{"page_no":81,"url":154,"width":155,"height":156},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/084712a22bb69f564825bc67b254eb29.webp",981,1269,{"page_no":19,"url":158,"width":159,"height":160},"https://res-academy.cache.wpscdn.com/upload/kdocshare/2026-11-18/49ddf4ab13b0f64c9bea0654a00ecc56.webp",980,1268,{"list":162,"token":66},[163,170,176,183,189,196,203,210,217,223],{"doc_id":164,"doc_title":165,"file_type":137,"home_preview_img_url":166,"slug":167,"view_count":168,"category_name":40,"create_tm":169},83934,"Parallel O( √n ) Overhead LSD Radix Sort","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229809116444/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=cNrfBkgzenqmK8rJpJJHRCblv7s%3D","parallel-o-n-overhead-lsd-radix-sort",17,1784191536,{"doc_id":171,"doc_title":172,"file_type":137,"home_preview_img_url":173,"slug":174,"view_count":29,"category_name":40,"create_tm":175},650978,"Drawing Unordered Trees on k-Grids","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229973228891/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=LIHAQShZXiAUkwCvB92c0s%2Fy4eA%3D","drawing-unordered-trees-on-k-grids",1792855692,{"doc_id":177,"doc_title":178,"file_type":137,"home_preview_img_url":179,"slug":180,"view_count":181,"category_name":40,"create_tm":182},85866,"Limited Independence Suffices for Large-k Min-wise Hashing","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229809361241/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=Av625Z3U%2BpSjJhSnWnwBdbTc%2F1A%3D","limited-independence-suffices-for-large-k-min-wise-hashing",31,1784206785,{"doc_id":184,"doc_title":185,"file_type":137,"home_preview_img_url":186,"slug":187,"view_count":24,"category_name":40,"create_tm":188},467699,"Empirical Evaluation of Unoptimized Sorting Algorithms on 8-Bit AVR Arduino Microcontrollers - Academic Study","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229926500366/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=RwEkTBZea4tqUnYqaLDtLs5N%2BbI%3D","empirical-evaluation-of-unoptimized-sorting-algorithms-on-8-bit-avr-arduino-microcontrollers-academic-study",1790773220,{"doc_id":190,"doc_title":191,"file_type":137,"home_preview_img_url":192,"slug":193,"view_count":194,"category_name":40,"create_tm":195},81836,"SemHash-LLM Multi-Granularity Semantic Hashing Framework for Document Deduplication","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229808686218/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=cHabFZmqH5A7dS17Qpon1mS403o%3D","semhash-llm-multi-granularity-semantic-hashing-framework-for-document-deduplication",29,1784176523,{"doc_id":197,"doc_title":198,"file_type":137,"home_preview_img_url":199,"slug":200,"view_count":201,"category_name":40,"create_tm":202},82732,"Beyond Post-Quantization Native Hash Learning with a Dedicated Hash Token","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229808783387/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=iv3JbXwNi1qSY4Pp7ZBE6iZEzlA%3D","beyond-post-quantization-native-hash-learning-with-a-dedicated-hash-token",22,1784182567,{"doc_id":204,"doc_title":205,"file_type":137,"home_preview_img_url":206,"slug":207,"view_count":208,"category_name":40,"create_tm":209},85756,"Learning Partition Trees for Nearest Neighbor Search","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229809350890/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=jfbNywltYE7ABKibcAU4%2BS2pwDs%3D","learning-partition-trees-for-nearest-neighbor-search",25,1784206037,{"doc_id":211,"doc_title":212,"file_type":137,"home_preview_img_url":213,"slug":214,"view_count":215,"category_name":40,"create_tm":216},85221,"A Faster Closest-Point Algorithm for the A*ₙ Lattices","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229809250667/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=O7M96okypc1de4Nb%2Fe%2FIIEI%2FgEg%3D","a-faster-closest-point-algorithm-for-the-a-lattices",24,1784201816,{"doc_id":218,"doc_title":219,"file_type":137,"home_preview_img_url":220,"slug":221,"view_count":208,"category_name":40,"create_tm":222},81906,"On a Boolean Function Without Bold Folding in the Spectrum Support and Implications for Greedy Approaches to PDT Depth","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229808693598/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=%2BAFFD%2Bp2MQz4DRpjfXnw1otC%2BNQ%3D","on-a-boolean-function-without-bold-folding-in-the-spectrum-support-and-implications-for-greedy-approaches-to-pdt-depth",1784176981,{"doc_id":224,"doc_title":225,"file_type":137,"home_preview_img_url":226,"slug":227,"view_count":228,"category_name":40,"create_tm":229},375785,"The Association Between IL-8 Gene Polymorphisms and the Risk of Several Types of Cancer, Especially in Gastric Cancer","https://weboffice-temporary-prod-sg.obs.ap-southeast-3.myhuaweicloud.com:443/export/thumbnail/export/thumbnail/110229914082224/last/300/407?AWSAccessKeyId=HPUAE6OPDRI9QZXR6WJG&Expires=1796109779&Signature=6ugHLSo2C3j5TDukuwj4NqtYaNI%3D","the-association-between-il-8-gene-polymorphisms-and-the-risk-of-several-types-of-cancer-especially-in-gastric-cancer",14,1790216129]