简体   繁体   中英

C# remove item from queue

I have code from this side

http://www.algorytm.org/klasyczne/kolejka/kolejka-1-cs.html

I create queue: 2(first),3,4,2,4,3,4,2(last)

What I need to do:

Create a method that remove an item "2" from this queue.

Thx.

First, your collected code is so annoying (it's Polish writing, not English).

I just can help you by providing pseudocode:

DelItem(Item, PrevE, CurrE)
  1. If CurrE= LastE
        If CurrE.Item = Item
            PrevE.Next = null
            Delete(CurrE)
        return
  2. NextE = CurrE.Next
  3. If CurrE.Item = Item
        PrevE.Next = NextE
        Delete(CurrE)
        CurrE = PrevE
        NextE = CurrE.Next
  4. DelItem(Item, CurrE, NextE)

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM