Пример #1
0
void test1(){
    printf("[%s]--------\n", __PRETTY_FUNCTION__);
    SLL* ssl = new SLL();
    ssl->append(1);
    ssl->print();
    printf("---------------------------------\n");
}
Пример #2
0
void test0() {
    begin();
    SLL<int>* ddl = new SLL<int>();
    ddl->append(new Node<int>(1));
    int count = ddl->count();
    printf("[%d]", count);
    delete ddl;
}
Пример #3
0
int main() {
    SLL list;
    list.make();
    list.push_back(100); list.push_back(50);
    list.push_front(75); list.print();
    list.push_after(35,100); list.print();
    list.del(50); list.print();
    return 0;
}
Пример #4
0
void testCloneSLL0(){
    printf("[%s]--------\n", __PRETTY_FUNCTION__);
    SLL* ssl = new SLL();
    Node* n1 = new Node(1);
    Node* n2 = new Node(2);
    Node* n3 = new Node(3);
    ssl->append(n1);
    ssl->print();
    printf("---------------------------------\n");
    SLL* cll = new SLL();
    cll->head = cloneSLL(ssl->head);
    cll->print();
    printf("---------------------------------\n");
} 
Пример #5
0
int main()
{
    SLL list;
    int n,posisi;
    string data;
    list.make();

    cin >> n;
    for(int i=0;i<n;i++){
        cin >> data >> posisi;
        list.posisikan(data,posisi);
        //list.find(data,posisi);
        //list.push_back(data,posisi);
    }
    list.print();
    return 0;
}
Пример #6
0
void test5(){
    printf("[%s]--------\n", __PRETTY_FUNCTION__);
    SLL* ssl = new SLL();
    Node* n1 = new Node(1);
    Node* n2 = new Node(2);
    Node* n3 = new Node(3);

    ssl->append(n1);
    ssl->append(n2);
    ssl->append(n3);
    ssl->print();
    printf("---------------------------------\n");
    ssl->remove(n1);
    ssl->remove(n3);
    ssl->remove(n2);
    ssl->print();

    printf("---------------------------------\n");
} 
int main()
 {
  SLL list; // list is an object of class SLL
  list.appendNode (22.2);        
  list.appendNode (38.9);
  list.appendNode (45.4);
  cout<<"Display of value stored in each node"<<endl;
  list.displayList();
  list.appendNode(50.5);
  list.appendNode(68.6);
  cout<<"\nDisplay of value stored in each node after appending two more nodes"<<endl<<endl;
  
  list.displayList();
  list.insertNode(10.1);
  list.insertNode(49.9);
  cout<<"\nDisplay the list after inserting node at correct position"<<endl;
  list.displayList();
  list.deleteNode(38.9);
  list.deleteNode(68.6);
  list.deleteNode(10.1);
  cout<<"\nDisplay the list after deleting the node"<<endl;
  list.displayList();
  cin.get();
  return 0;
 }