hii deceptiokn my question is we know we can implement a bubble sort in an array.Is it possible to implement
bubble sort in circular doubly linked list?????

Recommended Answers

All 4 Replies

It's possible to bubble sort a linked list, but it's kind of dumb given the overhead of indexing a linked list on top of the weakness of bubble sort.

Unless you are told to do otherwise you don't swap the entire nodes when sorting the list, just swap the data so that the pointers remain unchanged. Some instructors won't let you get away with it that easy though, so you need to ask him/her.

ok my question if i implement a bubble sort will it be a worst case time complexity????????

Probably, unless the data is already nearly sorted. Study this article

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.