It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 12 years ago.
As part of a library project, I want to include a plethora of generic algorithms and data structures. This includes algorithms for searching and sorting, data structures like linked lists and binary trees, path-finding algorithms like A*... the works.
Basically, any generic algorithm or data structure you can think of that you think might be useful in such a library, please post or add it to the list. Thanks! (NOTE: Because there is no single right answer I've of course placed this in community wiki... and also, please don't suggest algorithms which are too specialized to be provided by a generic library)
The List:
Data structures
AVL tree
B-tree
B*-tree
B+-tree
Binary tree
Binary heap
Binary search tree
Linked lists
Singly linked list
Doubly linked list
Stack
Queue
Sorting algorithms
Binary tree sort
Bubble sort
Heapsort
Insertion sort
Merge sort
Quicksort
Selection sort
Searching algorithms
Have you tried Wikipedia?
http://en.wikipedia.org/wiki/List_of_data_structures
http://en.wikipedia.org/wiki/List_of_algorithms
Algorithms, Data Structures.
There's already a resource for this sort of material. I'm voting to close as not a real question.
Related
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
I was looking at plenty of tree data structures and it is really confusing. Like I understand the basic Binary Trees(also its numerous implementations like the BST Red black trees etc)
But what i really need is some information on N'ary trees.
I need to study various types of N' ary trees and also their performance comparisons.
The only N' ary tree I have seen till now is B+ tree. I need to know which is the fastest N' Ary tree. i.e the most optimized time complexity wise, space complexity is no issue.
Generally, making something a K-ary tree, , does not give any asymptotic advantage over a binary tree (). For example, searching a a balanced binary tree can be done in time. Searching a balanced k-ary tree, will give you . Assuming is a constant, and for any other base, are equivalent asymptotically (the growth rates will be the same for large ). That is, is equivalent to for any and . Therefore, .
Practically, however, a k-ary tree might result in better memory access patterns, because each node contains nodes next to eachother, which means the height of the tree is shorter (wikipedia gives the height, , for a complete k-ary tree as , which is asymptotically the same for any constant ), and traversal might jump around less as well, since leaf nodes can contain multiple in-order keys.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
What is the most efficient way to add an element to a sorted data structure?
Most red black tree packages will have an "insert element" method. If you're not using one already, it might be good to start.
If you're married to a red-black tree implementation that doesn't have an insert element operation, it'd be a good idea to add such a method, possibly from some good red-black tree doc:
http://en.wikipedia.org/wiki/Red%E2%80%93black_tree
BTW, a treap is often quite a bit faster than a red-black tree, but the red-black tree will likely have less variable performance:
http://stromberg.dnsalias.org/~strombrg/python-tree-and-heap-comparison/
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
I have a set of 50 items and many conditions that specificy which element should come before other.
How to I create a ordered list?
Will like it in C# though can translate it from other languages.
Topological Sort
Translate the "many conditions" into a comparison function, and then use that in conjunction with a comparison-based sort (in the general case).
The best comparison-based sorting algorithms are O(nlogn) in the best case. Merge sort is one such algorithm and is pretty easy to implement... there are many others.
If your conditions constitute a partial ordering (rather than a total ordering), Topological sort might be most appropriate.
There are a number of sorting algorithms you can look into. The two that come to mind off the top of my head are the bubble sort and the quick sort.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 11 years ago.
Could someone please list where some of the following algorithms/structures pop up in web development (I'm an aspiring web developer and I'm curious to know when these various topics pop up):
Bubble sort
Insertion sort
Selection
sort
Mergesort
Quicksort
Stack
Queue
Linked List
Binary Trees
Binary Search Trees
Balanced Binary Tree
AVL Trees
Splay Trees
Red-Black trees
Priority Queues
Hashing
Adjacency Linked Lists
Adjacency matrices
Graph
Traversals (Depth First Search,
Breadth First Search)
Minimum
Spanning Trees (Kruskal's algorithm,
Prim's algorithm)
Directed Graph
(Digraph)
Topological sort
The list is some topics that were covered in my Data Structures and Algorithms class. There might be some other important ones that I forgot to list as well.
Most of these are important for teaching concepts, and while some of them are commonly used in most applications (Stacks & Queues, e.g.), they don't really "pop up" the way you're describing.
It is important to understand the principles that these structures illustrate, and to know when to use a LinkedList vs an ArrayList. But as far as "when will I ever use this," it's awfully hard to point to a specific part of a website and say, "see, they used a binary search tree here."
For most web development, these can be grouped together.
Quite a bit of web development is going to use a SQL back-end. In a select statement, you can have an order by clause what will undoubtedly be implemented by one of the sorts you've named (or something similar such as intro-sort, which is mostly a fairly minor variation on Quicksort).
Likewise, you'll deal with associative arrays, which are typically implemented as either some sort of hash table or some sort of balanced tree -- but could also use a splay tree.
graphs and graph traversal don't figure heavily in your typical (e.g., e-commerce) web development. For some types of network management, however, it's typical to put such things as servers into nodes of a graph, with arcs to signify the network connections.
Most languages you use will use stacks implicitly, but it'll be fairly unusual to use them explicitly in typical web development.
Queues will depend. You're not likely to implement a queue, but if (for example) you deal with a distributed database, you'll probably end up using some sort of queue that it provides.
It's difficult to tell what is being asked here. This question is ambiguous, vague, incomplete, overly broad, or rhetorical and cannot be reasonably answered in its current form. For help clarifying this question so that it can be reopened, visit the help center.
Closed 10 years ago.
What are Splay tree, Red-black tree, AVL tree, B-tree and T-tree?
I'm looking for good implementations.
These are all data structures used for quickly searching binary data. Many are used by different data management systems.
They differ in their approach for storage of data. I'd recommend reading up on each.
Splay: http://en.wikipedia.org/wiki/Splay_tree
Red-Black: http://en.wikipedia.org/wiki/Red-black_tree
AVL: http://en.wikipedia.org/wiki/Avl_tree
B-Tree: http://en.wikipedia.org/wiki/B-Tree
T-Tree: http://en.wikipedia.org/wiki/T-tree
The Tree Data Structure article on Wikipedia would be a good starting point for anyone wanting to learn about different tree structures. I believe that all of the referenced structures have links on the main Tree Data Structure entry.
For implementations I would recommend looking at Cormen's Introduction to Algorithms text, also referenced at wikipedia. If you want concrete implementations, you'll need to specify your desired language.
http://en.wikipedia.org/wiki/Tree_data_structure
Besides the online resources I would also recommend you to get a real book about algorithms. I would strongly recommend Sedgewick:
Algorithms in C++
Algorithms in Java
These are great books that will teach various algorithms (trees, search, graphs, etc.).