0% found this document useful (0 votes)
22 views3 pages

Pseudocode For Dsa

The document describes functions required for a music player application including functions to add and remove songs from a playlist, play songs, display playlists and recently played songs, search for songs, and manage the main program flow.

Uploaded by

Apurv Pegwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
22 views3 pages

Pseudocode For Dsa

The document describes functions required for a music player application including functions to add and remove songs from a playlist, play songs, display playlists and recently played songs, search for songs, and manage the main program flow.

Uploaded by

Apurv Pegwar
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 3

Functions required for making music player-

1. tofile() –
Function to work on playslist.txt.
2. add_node() –
Function that adds songs to the list using a linked list.
3. add_node_file() –
Function that adds songs to the playlist to linked list from the data passed in
addplaylist() function.
4. delete_file() –
Function to delete song from text file playlist.txt.
5. del_node() –
Function that deletes the last song from the input linked list.
6. printlist() –
Function that displays the input songs of the playlist.
7. count_nodes() –
Function that tracks the number of inputs in the linked list.
8. del_pos() –
Function that deletes songs from the linked list using the position of that song.
9. search1() –
Function that takes song input and linearly searches through the linked list and finds
matching case.
10. push() –
Function that pushes the last played track of play() function into a stack to store and
create a recently played list.
11. display() -
Function to display the stack generated in push() function.
12. play() -
Function to search input song and show if it can be played. It then passes the song to
push() function to be added to recently played list.
13. recent() -
Function that calls display() function.
14. topelement() –
Function that displays the last played song.
15. addplaylist() –
Function that opens text file playlist.txt and passes data to add_node_file() function.
16. del_search() –
Function to search input song and delete it from the list.
17. deletemenu() –
Function to invoke del_search() or del_pos() functions depending on user input.
18. main() –
Function that invokes all other functions of the project based on user defined input.

Pseudocode for music player:

Create a new empty queue called "playlist"


Create a new empty list called "all_songs"

while true:
display the current song in the playlist

if the playlist is empty:


ask the user to add songs to the playlist

display the available options:


1. Add a song to the playlist
2. Remove the current song from the playlist
3. Play the next song in the playlist
4. Shuffle the playlist
5. Display all available songs
6. Search for a song
7. Quit the music player

ask the user to choose an option

if the user chooses option 1:


ask the user to enter the name of the song
if the song is in the "all_songs" list:
enqueue the song into the playlist
display a message saying the song has been added to the playlist
else:
display a message saying the song does not exist

if the user chooses option 2:


dequeue the current song from the playlist

if the user chooses option 3:


dequeue the current song from the playlist
display the next song in the playlist

if the user chooses option 4:


shuffle the playlist

if the user chooses option 5:


display all songs in the "all_songs" list

if the user chooses option 6:


ask the user to enter a search term
search for songs in the "all_songs" list that match the search term and display
them

if the user chooses option 7:


quit the music player

if the playlist is empty and the user did not choose to quit:
display a message saying that the playlist is empty and ask the user to add
songs to the playlist

You might also like