Mridul-1-Sharma / data_structures_algos

Contribute to this repository with valid pull request to Hacktoberfest 2022 and earn awesome swags & T-shirts. This is a beginner friendly Project.
MIT License
6 stars 27 forks source link

Add two more functions in arrayLinkedList class #50

Closed JunJul closed 1 year ago

JunJul commented 1 year ago

The search function is to search an element in the list if it cannot find the element, so return -1. If it finds the element, then delete it. We need to move the elements in the array when deleting an element. This remove function still costs O(n). On the contrary, a linked list only need to link node together after removing a node. This is O(1).

JunJul commented 1 year ago

This description is for the graph one.

// We can create either a directed graph or an undirected graph according to the flag // if the flag is false which means undirected; otherwise, it is directed // insert vertex and return its index which will be used for insertEdge // for example if we have A and B two vertices in the array, which are index 0, 1 // so insert the edge in edges[0][1] and edges[1][0] if it is an undirected graph // if it is directed, only need to do edges[0][1]

JunJul commented 1 year ago

@Mridul07Sharma Hi, I think I have done two pull requests here, but it seems I only can see my first pull request here. When my first pull request is closed, my next one will be pulled out, right?

JunJul commented 1 year ago

Ok, after this. I will do one more pull request for my graph, sorry about this.

Mridul-1-Sharma commented 1 year ago

Please add files of only c and cpp code

do not add .h files