Effective routing algorithms are crucial for optimizing network communication in various domains, including telecommunications, computer networks, and transportation systems. This research paper proposes a novel routing algorithm and compares its performance with existing algorithms to identify the most efficient solution. By evaluating factors such as latency, throughput, scalability, and resource utilization, this study aims to provide insights into improving network routing for enhanced performance and reliability. These algorithms have go through the important role in networks and in suggesting the best path for data transmission. In this study, we propose a novel routing algorithm and conduct a comprehensive comparison with established algorithms to identify the best path for routing in various network scenarios with the removal of blackhole and wormhole attack. The proposed algorithm is designed to optimize path selection based on key metrics such as packet delivery ratio, end-to-end delay, throughput and robustness. To evaluate its performance, we implement the proposed algorithm alongside well-known routing algorithms, and prominent routing protocol such as AODV. In this research we found that it the packet delivery ratio and throughput become higher than this is the proof that the data packet has been follows the best path to the destination. Using a simulated environment, we generate diverse test cases representing different network topologies, traffic patterns, and failure scenarios. Through extensive experimentation, we collect and analyzed performance metrics for each algorithm, enabling a thorough comparison of their strengths and weaknesses. Our findings provide valuable insights into the effectiveness of the proposed algorithm relative to existing approaches. Research highlights its unique advantages and areas for improvement, offering valuable guidance for network engineers and researchers seeking optimal routing solutions. This study contributes to the ongoing evolution of routing algorithms, facilitating more efficient and reliable network communication in diverse environments.