lazy delete

This is a discussion on lazy delete within the C++ Programming forums, part of the General Programming Boards category; Can any one tell me what is the meaning of lazy deletion in an array?...

  1. #1
    Registered User
    Join Date
    Oct 2002
    Posts
    38

    lazy delete

    Can any one tell me what is the meaning of lazy deletion in an array?
    please set free our POWs

  2. #2
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    "lazy deletion" usually means you just mark somthing as deleted, instead of actually deleting it.

    gg

  3. #3
    Registered User
    Join Date
    Oct 2002
    Posts
    38
    Thanx for answering
    this mark will be a flag?
    please set free our POWs

  4. #4
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    Sure, however you want to do it.

    gg

  5. #5
    Registered User
    Join Date
    Oct 2002
    Posts
    38
    i've searched in a browser about this but couldn't find anything helpful i have a midterm after one day and this was a question from last course (to write a code for deletion and insertion using flags (lazy deletion) in an array of a specefied size)i know i've got to have a node structure contains an integer data and a bool flag but couldn't know the method.

    Code:
    #include <stdio.h>
    #include <malloc.h>
    
    
    struct node{
    
    int data;
    bool deleted;
    node(int x){data=x; deleted=Fales;}
    };
    
    class queue{
    
    private:
    node element[100];
    
    public:
    //????????
    
    };
    please set free our POWs

  6. #6
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    You should read your text book.

    queue ADT

    gg

  7. #7
    Registered User
    Join Date
    Oct 2002
    Posts
    38
    Thanx
    i know how to do a class queue with its functions but what i wanted to do is to use the lazy deletion method that like if i had an array of 6 elements i want to delete a certin element given from the user not its first element i know how to do it by loop and shifting but don't know how to use the flags and the lazy method.
    please set free our POWs

  8. #8
    Registered User Codeplug's Avatar
    Join Date
    Mar 2003
    Posts
    4,669
    Since you are using a static array of nodes, there is no use for lazy deletion since there is nothing to delete in the first place. If your queue were implemented using a linked list, then you could use lazy deletion.

    gg

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Delete Function in Doubly Linked List
    By Dampecram in forum C Programming
    Replies: 5
    Last Post: 11-15-2008, 03:30 PM
  2. BST delete again, but this time I think I'm close
    By tms43 in forum C++ Programming
    Replies: 9
    Last Post: 11-05-2006, 05:24 PM
  3. delete and delete []
    By Lionel in forum C++ Programming
    Replies: 8
    Last Post: 05-19-2005, 01:52 PM
  4. why is this prog crashing on delete?
    By Waldo2k2 in forum Windows Programming
    Replies: 2
    Last Post: 12-04-2002, 10:17 PM
  5. Problem need help
    By Srpurdy in forum C++ Programming
    Replies: 1
    Last Post: 07-24-2002, 12:45 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21