1 /*queues implemented with linked lists-using double-ended lists2 * NOTE: null pointer error must be reference not pointing to object3 * */4 Public classMylinkedqueue {5 Privatemyfirstandlastlinkedlist list;6 Private intitems;7 8 PublicMylinkedqueue () {9List =Newmyfirstandlastlinkedlist ();TenItems = 0; One } A - Public BooleanIsEmpty () { - returnList.isEmpty (); the } - - Public voidInsertintkey)
Binary Tree chain Storage Structure-binary linked list
Only the header file is attached here:
The Code has been shared in the resource:
Address: http://download.csdn.net/detail/ta893115871/4751186
Header file:
/** Tree. h ** created on: 2012-10-31 * Author: China * QQ: 893115871 ** using a linked list can avoid space waste in sequential
C Language Data Structure-Definition of discrete storage linked list, Discrete Data Structure1. Definition:
N nodes are discretely allocated and connected to each other through pointers.
Each node has only one parent node.
Only one subsequent Node
The first node does not have a precursor node, and the last node does not have a subsequent Node
2. Terminology:
First node: the first valid node
Tail node
Binary tree Two-fork list storage representation//Xin Yang # include Data structure of the---C language implementation of the two-fork tree two-linked list storage representation
Recently has been busy with postgraduate examination, a long time has not updated the blog, today write a data structure of the storage.Cross-linked list storage representations for graphs//Xin Yang # include Results: Copyright NOTICE: This article for Bo Master original article, without Bo Master permission not reproduced. Data structure---The cross-linked list
A common programming problem:
Which one is faster than traversing arrays and linked lists of the same size?According to the algorithm analysis method in university textbooks, you will conclude that these two are as fast as they are because the time complexity is O (n ). However, in practice, the two are very different. The following analysis shows that arrays are much faster than linked lists.
First, we will introduce a concept: Memory Hierarchy (storage
The basic principle is:
During the stack import process, split the header and the first node and insert them into the stack element node.
The first node is deleted during the stack export process.
classCStackLinkList{private:SNode*pCStackLinkListHeader;intnLinkListNodeSize;public:CStackLinkList(){pCStackLinkListHeader=NULL;nLinkListNodeSize=0;}~CStackLinkList(){//judgeheaderpointerisnullandreturnif(NULL==pCStackLinkListHeader)return;//Icanusepopfunctiontodeleteallnodeinttmp=0;while(PopStack(tmp)
[temp.num]==false)S.push (Temp.num);Temp=temp.next;}}Else{Endt[num]=time;S.pop ();Topologicalsort.addfirst (Adj[num]);}}}/*** Topological sequencing (for loop-free graphs)* Depth-first traversal by end time from large to small sort* End time large represented as the front node*/public void Topologicalsort (){DFS ();for (int i=0;i{int Num=topologicalsort.get (i). Num;System.out.println ("+i+" executed by "+" Node "+num+": "+startt[num]+"/"+endt[num]");}}public static void Main (String []args){Gra
() {return
cursor;
}
public void setcursor (int cursor) {
this.cursor = cursor;
}
}
Test class public
class Main {public
static void Main (string[] args) {
int arr[] = {1, 3, 4, 5, 6};
Staticlinkedlist list = new Staticlinkedlist (arr);
System.out.print ("initialization: \ n");
List.display ();
System.out.print ("\ n) after inserting 2 at the corner Ma
(self.name))defShengji (self):Print('%s Upgrade complete, attack damage, current attack%d'% (self.name,self.tak*2))#Single TurretclassDan (Pata):def __init__(Self,name,tak): Super ().__init__(Name,tak)Print('capable of attacking a single target')defJiansu (self):Print('%s release skill deceleration'%(self.name))#crowd turretclassQun (Pata):def __init__(Self,name,tak): Super ().__init__(Name,tak)Print('ability to attack group targets')defGongji (self):Print('{} for group output'. Format (self.na
Today we summarize the two-way loop linked list in a linear table.What is a two-way circular linked list?look at the name, you know, Prime Minister. He is a circular list, that is, the last node of the pointer field is not empty, but point to the head node, followed by a one-way circular linked list, it is bidirectiona
The This article is from the "Everything Possible" blog, please be sure to keep this source http://noican.blog.51cto.com/4081966/1598940Linear table of data structure--a single linked list of chained storage structures (PHP code implementation)
1#include 2 3#include 4#include 5 6 using namespacestd;7 8 #defineOK 19 #defineTRUE 1Ten #defineFALSE 0 One #defineERROR 0 A -typedefintStatus//the returned status value -typedefintElemtype;//types of data in a node the - //Data Structure -typedefstructNode - { +Elemtype data;//Data -Node *next;//pointer to next node + }node; AtypedefstructNode *sqlist; at - //single-Link table creation, head interpolation -Status Greatlisthead (SqList *l,intN) - { - Srand ((unsigned) time (NULL)); - sqlist p
find the address of a at newDeleteQ//Recycling StudentDeleteR//the space is retracted, and the destruction only makes aDelete[] r;//Destructors All ObjectsOnly at compile time--public: Common--private: Self-member function of the class, two objects of the same kind can access the private variables with one another.--protected:Friend: Another class, a function inside another class.structX//declaration of preceding paragraphstructy{voidF (x*); };structx{Private: inti; Public: voidInitialize
not automatically give you the sort, you add: 3,5,4 He will not give you a line 345. It is arranged only in the order in which it is added.HashMap is a form of implementation of map, it is also non-thread-safe, it is unordered, you can add something after the calculation of the hash value in front of the back, he mainly by the form of key and value to obtain
The elements in the list are repeatableThe elements in set are non-repeatable
The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion;
products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the
content of the page makes you feel confusing, please write us an email, we will handle the problem
within 5 days after receiving your email.
If you find any instances of plagiarism from the community, please send an email to:
info-contact@alibabacloud.com
and provide relevant evidence. A staff member will contact you within 5 working days.