Go vs Other Languages

Memory

Go CPP
Memory Management Go has Automatic Garbage Collection, which means memory
allocation and deallocation are handled by the runtime
CPP programmer has to do memory management using new, delete.
Structural Differences No hidden function as compared to c++

type ListNode struct {
    Val int
    Next *ListNode
}
                        
CPP have hidden functions, which can add overhead

class ListNode {
    int val;
    ListNode *next;
public:
    //constructor
    //destructor
};                            
                        
RunTime overhead Less More due to Exception handling, virtual function calls, and dynamic dispatch

Time