• 欢迎访问废江's博客 QQ群
  • 如果您觉得本站非常有看点,那么赶紧使用Ctrl+D 收藏本站吧

Doubly Linked List

AOJ 站点默认 11个月前 (04-05) 589次浏览 已收录 71个评论
文章目录[隐藏]

Question

Your task is to implement a double linked list.

Write a program which performs the following operations:

insert x: insert an element with key x into the front of the list.
delete x: delete the first element which has the key of x from the list. If there is not such element, you need not do anything.
deleteFirst: delete the first element from the list.
deleteLast: delete the last element from the list.
Input
The input is given in the following format:

n
command1
command2

commandn
In the first line, the number of operations n is given. In the following n lines, the above mentioned operations are given in the following format:

insert x
delete x
deleteFirst
deleteLast
Output
Print all the element (key) in the list after the given operations. Two consequtive keys should be separated by a single space.

Constraints
The number of operations ≤ 2,000,000
The number of delete operations ≤ 20
0 ≤ value of a key ≤ 109
The number of elements in the list does not exceed 106
For a delete, deleteFirst or deleteLast operation, there is at least one element in the list.
Sample Input 1
7
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5
Sample Output 1
6 1 2
Sample Input 2
9
insert 5
insert 2
insert 3
insert 1
delete 3
insert 6
delete 5
deleteFirst
deleteLast
Sample Output 2
1

Meaning

写链表实现双向链表的操作

Solution

这题坑我了三四个小时,oj测试数据中的第四组删除一个根本就不存在的数据。所以代码只能ac前面三个测试。用的是教材上面的双向链表。后面经过一个大佬给我修改了一下bug,原本在deleem函数中是不能删除最后一个节点的。但是还是不能ac,很恶心,不想看这一题了。感觉弄了好久啥也没学到。

Coding

Summary


个人博客 , 版权所有丨如未注明 , 均为原创丨本网站采用BY-NC-SA协议进行授权
转载请注明原文链接:Doubly Linked List
喜欢 (0)
[]
分享 (0)
发表我的评论
取消评论

表情 贴图 加粗 删除线 居中 斜体 签到
(71)个小伙伴在吐槽
  1. buy viagra online in melbourne achat viagra canada viagra by mail order canada
    匿名2021-02-18 18:29 回复 未知操作系统 | Firefox浏览器 40.0
  2. I think the admin of this website is in fact working hard for his website, as here every material is quality based information.| Eran Laird Anglo
    erotik2021-02-18 04:30 回复 Windows 10 | Chrome 86.0.4240.193
  3. In a market such as the volatile movement of Bitcoin, I think this is a great idea to secure the money of investors, whether small or large. Allegra Owen Farlee
    erotik2021-02-18 01:17 回复 Windows 10 | Chrome 86.0.4240.193
  4. This article will help the internet viewers for creating new blog or even a weblog from start to end.| Lula Scarface Himelman
    erotik2021-02-17 23:57 回复 Windows 10 | Chrome 86.0.4240.193
  5. It is a very good useful article I like to read such articles Hilary Pancho Nimesh
    erotik2021-02-17 22:30 回复 Windows 10 | Chrome 86.0.4240.193
  6. did they just limit the number of accounts for free version or I have missed that before? Tammy Baldwin Behre
    샌즈카지노2021-02-17 21:33 回复 Windows 10 | Chrome 86.0.4240.193
  7. Aute mi ut suspendisse velit leo, vel risus ac. Amet dui dignissim fermentum malesuada auctor volutpat, vestibulum ipsum nulla. Amalea Denis Guglielma
    샌즈카지노2021-02-17 20:35 回复 Windows 10 | Chrome 86.0.4240.193
  8. Thanks for sharing superb informations. Your web-site is so cool. I am impressed by the details that you have on this website. It reveals how nicely you perceive this subject. Bookmarked this website page, will come back for extra articles. You, my friend, ROCK! I found just the info I already searched all over the place and just could not come across. What an ideal web site. Kirbee Emmy Ilka
    erotik2021-02-17 19:38 回复 Windows 10 | Chrome 86.0.4240.193
  9. I am really enjoying the theme/design of your site. Gwenora Garry Moriyama
    샌즈카지노2021-02-17 16:15 回复 Windows 10 | Chrome 86.0.4240.193
  10. Thanks for the tips you have provided here. Cheers! Joyce Gaby Caton
    yabanci2021-02-17 15:02 回复 Windows 10 | Chrome 86.0.4240.193
  11. I pay a visit daily some blogs and sites to read posts, except this webpage presents feature based writing. Erina Boote Culosio
    erotik2021-02-17 14:42 回复 Windows 10 | Chrome 86.0.4240.193
  12. To cost, simply place the headset on the included magnetic charging base. Melony Olivero Goeger
    turkce2021-02-17 14:26 回复 Windows 10 | Chrome 86.0.4240.193
  13. A wonderful serenity has taken possession of my entire soul, like these sweet mornings of spring which I enjoy with my whole heart. I am alone, and feel the charm of existence in this spot Allix Gorden Nahshun
    turkce2021-02-17 13:42 回复 Windows 10 | Chrome 86.0.4240.193
  14. Oh my goodness! an impressive write-up dude. Thanks Nevertheless I am experiencing problem with ur rss. Don?t understand why Unable to sign up for it. Exists any individual obtaining similar rss issue? Any individual who understands kindly react. Thnkx Barbe Renault Winfrid
    turkce2021-02-17 13:08 回复 Windows 10 | Chrome 86.0.4240.193
  15. what's the best payday loan company for bad credit payday loans kansas laws payday loan quick cash
    匿名2021-02-17 10:24 回复 未知操作系统 | Firefox浏览器 40.0
  16. Yay google is my queen aided me to find this great website ! . Juditha Bail Zulema
    turkce2021-02-17 00:45 回复 Windows 10 | Chrome 86.0.4240.193
  17. can i mix viagra and cialis preço generico do cialis viagra or cialis for performance anxiety
    匿名2021-02-16 14:25 回复 Windows 10 | Firefox浏览器 43.0
  18. taking cialis directions cialis with prescription online interacciones cialis
    匿名2021-02-16 12:18 回复 Windows 7 | Chrome 61.0.3163.100
  19. sex kummer phukking HD PornHD Porn HD PornHD Porn Webcam porn Small Tits sex muff nude cumshot phukking cyberfucking fucks butthead cocksucked Tattooed Women cooter prick POV sex porn Creampie nude Fingering porn motherfuckers cocksuck Babe sex wetback cobia mick Public porn bonehead lesbo Strap On Exclusive sex mothafucker browntown Pissing ejaculation sex merde dildos sex Massage Masturbation cunts farts fistfuck merde hard on porn mothafuckin sex Fisting dinks horniest dipshit pussys ejaculates Muscular Men nude farts cocksucked mick porn Cumshot porn Compilation Gay boy sex cuntlicking porn orgasims browneye Bondage sex sex College bitchers porn motherfucker ejaculated Muscular Men buttfuck porn mothafuckings nude bestial Teen porn sex Described Video sex punk School fucker bitching cunnilingus Big Dick cocksucks Smoking nude farted Bondage Amateur porn fagot hotsex Small Tits sex muff nude cumshot phukking cyberfucking fucks butthead cocksucked Tattooed Women cooter prick POV sex porn Creampie nude Fingering porn motherfuckers cocksuck Babe sex wetback cobia mick Public porn bonehead lesbo Strap On Exclusive sex mothafucker browntown Pissing ejaculation sex merde dildos sex Massage Masturbation cunts farts fistfuck merde hard on porn mothafuckin sex Fisting dinks horniest dipshit pussys ejaculates Muscular Men nude farts cocksucked mick porn Cumshot porn Compilation Gay boy sex cuntlicking porn orgasims browneye Bondage sex sex College bitchers porn motherfucker ejaculated Muscular Men buttfuck porn mothafuckings nude bestial Teen porn sex Described Video sex punk School fucker bitching cunnilingus Big Dick cocksucks Smoking nude farted Bondage Amateur porn fagot hotsexfagget Funny porn sex Fetish cyberfucker porno shitting Pornstar porn motherfuckings gazongers Hentai HD PornHD Porn Interracial orgasms sex pissin porn Creampie cocks jack-off loser cumshot fellatio dike Winifred Hunfredo Madelyn
    turkce2021-02-16 05:20 回复 Windows 10 | Chrome 86.0.4240.193
  20. Thanks for a marvelous posting! I quite enjoyed reading it, you might be a great author. I will make sure to bookmark your blog and will often come back someday. I want to encourage that you continue your great posts, have a nice day!| Aubrette Sigismondo Robby
    turkce2021-02-16 04:33 回复 Windows 10 | Chrome 86.0.4240.193
  21. Very good article! We will be linking to this particularly great article on our site. Keep up the good writing. Roby Filberto Lumbard Dottie Land Sheeree
    turkce2021-02-16 03:55 回复 Windows 10 | Chrome 86.0.4240.193
  22. I wish to convey my respect for your kind-heartedness supporting folks that should have help with the situation. Your very own dedication to passing the message all around appeared to be really advantageous and has frequently enabled guys just like me to attain their targets. Your insightful guide means this much a person like me and even more to my fellow workers. Thanks a lot; from all of us. Kylynn Uriah Lock
    turkce2021-02-16 03:07 回复 Windows 10 | Chrome 86.0.4240.193
  23. Hi, this weekend is nice in favor of me, because this point in time i am reading this impressive educational article here at my house. Nessy Stearne Lidda
    turkce2021-02-16 01:10 回复 Windows 10 | Chrome 86.0.4240.193
  24. Awesome write-up. I am a normal visitor of your site and appreciate you taking the time to maintain the nice site. I will be a frequent visitor for a long time. Farrand Ernst Bjork
    turkce2021-02-15 23:43 回复 Windows 10 | Chrome 86.0.4240.193
  25. Hello. This post was extremely motivating, especially since I was searching for thoughts on this topic last Thursday. Lotti Lionel Brewer Jeana North Bella
    turkce2021-02-15 21:26 回复 Windows 10 | Chrome 86.0.4240.193
  26. What a super posting full of news and lovely pictures. Big contrast with your bridges. And how did you find a wee space to fit in amongst those scooters. Thank you and happy boating. Nicolea Saw Flossy
    turkce2021-02-15 20:19 回复 Windows 10 | Chrome 86.0.4240.193
  27. Thank you very much. The characteristics of the protagonist is what makes this novella so powerful. Evita Barnabas Sletten
    turkce2021-02-15 18:37 回复 Windows 10 | Chrome 86.0.4240.193
  28. Thanks to my father who informed me about this website, this webpage is really amazing. Eugenia Horace Prober
    turkce2021-02-15 17:13 回复 Windows 10 | Chrome 86.0.4240.193
  29. I think you have noted some very interesting points , thankyou for the post. Kipp Locke Fowler Ealasaid Basilio Kanal
    turkce2021-02-15 15:56 回复 Windows 10 | Chrome 86.0.4240.193
  30. Very good point which I had quickly initiate efficient initiatives without wireless web services. Interactively underwhelm turnkey initiatives before high-payoff relationships. Holisticly restore superior interfaces before flexible technology. Completely scale extensible relationships through empowered web-readiness. Novelia Hugh Farleigh
    turkce2021-02-15 13:38 回复 Windows 10 | Chrome 86.0.4240.193
  31. Hello There. I found your blog using msn. This is a really well written article. I will make sure to bookmark it and return to read more of your useful info. Thanks for the post. I will certainly return. Cathryn Lionello Fitzger
    turkce2021-02-15 04:57 回复 Windows 10 | Chrome 86.0.4240.193
  32. I think the admin of this site is actually working hard in favor of his web site, because here every data is quality based data. Zilvia Randell Valenza Lee Gareth Jakoba
    turkce2021-02-15 02:34 回复 Windows 10 | Chrome 86.0.4240.193
  33. mentum metus iaculis ac feugiat gravida urna interdum cras per nulla urna mattis class dapibus turpis ultrices posuere scelerisque dictu Hanni Michael Leatri
    turkce2021-02-15 01:02 回复 Windows 10 | Chrome 86.0.4240.193
  34. This is really interesting, You are a very skilled blogger. Casie Avictor Casey
    turkce2021-02-15 00:42 回复 Windows 10 | Chrome 86.0.4240.193
  35. j ai une garde normale soit un we sur 2 et la moitie des vacance scolaires je travaille et gagne 1700 e par mois si je fait des heures suplementaire sinon je gagnerais le smic ma pension pour mes 3 enfants et de 167 euro je paye le centre aere plein taril ayant pas d aide soit 154 euro pour 5 jours pour mes filles financierement c est dure ne beneficiant d aucune reduction ni de loyer ou d impot ou de centre aere je demande a mon ex d inscrire les filles au centre aere et je lui payerais ma semaine car elle a le QF pour les 3 enfants et donc paye moins chere mais elle refuse comment puis je faire par ce que je vais etre a decouvert tt les mois Rhetta Eduard Elissa
    turkce2021-02-14 23:23 回复 Windows 10 | Chrome 86.0.4240.193
  36. Thanks for the auspicious writeup. It in fact was once a leisure account it. Glance complex to far delivered agreeable from you! By the way, how can we be in contact? Fidela Ernie Burnie
    turkce2021-02-14 22:00 回复 Windows 10 | Chrome 86.0.4240.193
  37. I know this web page gives quality dependent content and extra information, is there any other website which gives such stuff in quality? Chelsey Berkley Madian
    turkce2021-02-14 16:37 回复 Windows 10 | Chrome 86.0.4240.193
  38. I do love the manner in which you have presented this specific problem and it does present us some fodder for thought. On the other hand, from what precisely I have observed, I basically trust as the reviews stack on that people remain on point and in no way embark on a tirade associated with the news of the day. Yet, thank you for this exceptional point and though I can not really go along with the idea in totality, I regard your point of view. Gilberta Harwilll Laraine
    turkce2021-02-14 12:58 回复 Windows 10 | Chrome 86.0.4240.193
  39. I could not resist commenting. Exceptionally well written! Shayne Pail Mungo
    turkce2021-02-14 09:13 回复 Windows 10 | Chrome 86.0.4240.193
  40. While I wish everyone a healthy and beautiful new year, I recommend the site sexfilmizle.com as the only address for good movies, respect and watch slm. Quintina Jourdain Ignaz
    turkce2021-02-14 07:05 回复 Windows 10 | Chrome 86.0.4240.193
  41. Good article. I will be going through many of these issues as well.. Taffy Reamonn Joelle
    turkce2021-02-14 05:51 回复 Windows 10 | Chrome 86.0.4240.193
  42. After exploring a few of the blog articles on your site, I truly like your technique of blogging. I bookmarked it to my bookmark webpage list and will be checking back soon. Take a look at my web site as well and let me know your opinion. Stella Frasco Wallace
    turkce2021-02-14 04:10 回复 Windows 10 | Chrome 86.0.4240.193
  43. A round of applause for your post. Thanks Again. Great. Imelda Cosme Gruver Cynthea Ivor Fording
    turkce2021-02-14 02:53 回复 Windows 10 | Chrome 86.0.4240.193
  44. I am sure this piece of writing has touched all the internet viewers, its really really nice post on building up new web site.| Modesty Morgen Boggers
    turkce2021-02-14 02:20 回复 Windows 10 | Chrome 86.0.4240.193
  45. You need to take part in a contest for one of the most useful websites on the net. I will recommend this blog! Sadie Klement Ewan
    turkce2021-02-14 01:09 回复 Windows 10 | Chrome 86.0.4240.193
  46. I reckon something truly special in this internet site. Lenore Scarface Hey
    turkce2021-02-14 00:23 回复 Windows 10 | Chrome 86.0.4240.193
  47. rasika therinthavanuku kaamam enna ? kadhal enna ? Athanaiyum kavidhaigal aagum Sydel Carly Shelburne
    turkce2021-02-13 23:18 回复 Windows 10 | Chrome 86.0.4240.193
  48. I was more than happy to find this page. I wanted to thank you for ones time due to this fantastic read!! I definitely enjoyed every part of it and I have you book marked to look at new information on your website. Karia Edik Dric
    turkce2021-02-13 22:26 回复 Windows 10 | Chrome 86.0.4240.193
  49. Very good point which I had quickly initiate efficient initiatives without wireless web services. Interactively underwhelm turnkey initiatives before high-payoff relationships. Holisticly restore superior interfaces before flexible technology. Completely scale extensible relationships through empowered web-readiness. Jayme Gunner Horn
    turkce2021-02-13 21:02 回复 Windows 10 | Chrome 86.0.4240.193
  50. payday loans bakersfield ca payday loan unemployment income gumtree instant cash loans
    匿名2021-02-13 03:10 回复 Windows 7 | Chrome 63.0.3239.84
  51. I just could not depart your site prior to suggesting that I actually loved the usual info an individual provide in your guests? Is going to be again incessantly in order to check out new posts. Rani Winifield Bernardi
    turkce2021-02-12 22:35 回复 Windows 10 | Chrome 86.0.4240.193
  52. legitimate payday loan companies check cashing loan rates payday loans for unemployed direct lenders
    匿名2021-02-12 20:36 回复 Windows 7 | Firefox浏览器 40.1
  53. When I originally commented I appear to have clicked the -Notify me when new comments are added- checkbox and now every time a comment is added I receive 4 emails with the exact same comment. Serena Dennison Dole
    amateur2021-02-12 12:42 回复 Windows 10 | Chrome 86.0.4240.193
  54. There is certainly a lot to find out about this topic. I really like all of the points you made. Chelsea Creight Anora
    erotik2021-02-12 10:43 回复 Windows 10 | Chrome 86.0.4240.193
  55. actually pay with paypal viagra how to buy viagra without insurance viagra soft tabs uk
    匿名2021-02-12 07:31 回复 Windows 10 | Chrome 62.0.3202.94
  56. viagra n line viagra australia buy generic viagra paypal
    匿名2021-02-11 13:25 回复 未知操作系统 | Firefox浏览器 37.0
  57. canada pharmaceuticals best price for generic viagra modafinil online pharmacy
    匿名2021-02-10 20:31 回复 Windows 8.1 | Firefox浏览器 57.0
  58. Greetings! Very helpful advice within this post! It is the little changes that will make the biggest changes. Thanks for sharing! Delinda Somerset Norvall
    yabanci2021-02-10 18:07 回复 Windows 10 | Chrome 86.0.4240.193
  59. Wow, fantastic blog layout! How long have you been blogging for? Sidonia Allan Broek
    dublaj2021-02-10 16:54 回复 Windows 10 | Chrome 86.0.4240.193
  60. walmart pharmacy price check northwest pharmacy discount prescription drug
    匿名2021-02-09 21:37 回复 Windows XP | Chrome 49.0.2623.112
  61. I have been browsing online more than three hours today, yet I never found any interesting article like yours. Sada Gasparo Amil
    diziler2021-02-09 20:03 回复 Windows 10 | Chrome 86.0.4240.193
  62. viagra online reviews viagra blue vision viagra generic canada
    匿名2021-02-09 19:17 回复 Windows 7 | Chrome 62.0.3202.94
  63. The excerpt is fascinating, I would definitely like to read more. Bambi Ricki Lidstone
    dizi2021-02-09 18:34 回复 Windows 10 | Chrome 86.0.4240.193
  64. Hi there Dear, are you in fact visiting this web page regularly, if so afterward you will definitely obtain fastidious knowledge. Flossie Clint Woodall
    mp32021-02-09 17:14 回复 Windows 10 | Chrome 86.0.4240.193
  65. Hello! Nice post! Please do keep us posted when we can see a follow up! Leland Derward Selene
    mp32021-02-09 15:28 回复 Windows 10 | Chrome 86.0.4240.193
  66. these look sooooo nice! definitely need to give these a go x Lethia Rowland Steiner
    dizi2021-02-08 21:31 回复 Windows 10 | Chrome 86.0.4240.193
  67. canadian pharmacy viagra generic buy cheap viagra in canada cheap prescription drugs
    匿名2021-02-08 19:15 回复 Windows 7 | Firefox浏览器 40.1
  68. canada pharma limited llc medicine online shopping canadian meds
    匿名2021-02-06 04:32 回复 Windows 7 | Chrome 62.0.3202.89
  69. canada drug prices canadian online pharmacies Cialis
    匿名2021-02-06 00:09 回复 Windows 7 | Chrome 61.0.3163.100
  70. This is a topic close to my heart cheers, where are your contact details though? Marnia Addison Tonye
    online2021-02-02 16:57 回复 Windows 10 | Chrome 86.0.4240.193
  71. Hiya, I am really glad I have found this info. Nowadays bloggers publish only about gossip and web stuff and this is really annoying. A good blog with exciting content, that is what I need. Thanks for making this web site, and I will be visiting again. Do you do newsletters by email? Claudetta Edward Elison
    dizi2021-02-02 15:47 回复 Windows 10 | Chrome 86.0.4240.193