GO evaluation for DSA course. This is the solution for Question 1 only.
This Go program converts a relative path into an absolute path based on the given current directory.
Follow these steps to clone and run the project:
Ensure you have Git installed, then run:
git clone https://github.com/rouhan14/question1.git
cd question1
Ensure you have GO installed, then run:
go run .
Run the program with the following test cases:
Input:
currentDir := "/home/user/docs/rouhan"
relativePath := "./pictures/image.jpg"Expected Output:
Absolute Path: /home/user/docs/rouhan/pictures/image.jpgInput:
currentDir := "/home/user/docs/rouhan"
relativePath := "../music/song.mp3"Expected Output:
Absolute Path: /home/user/docs/music/song.mp3Input:
currentDir := "/home/user/docs/rouhan"
relativePath := "../../music/song.mp3"Expected Output:
Absolute Path: /home/user/music/song.mp3Input:
currentDir := "/home/user/docs/rouhan"
relativePath := "../"Expected Output:
Absolute Path: /home/user/docs