Question

answer in c++ please , Your objective is to write the definition of the function Equal()...

answer in c++ please ,

Your objective is to write the definition of the function Equal() whose header is
template <typename T>
bool Equal(Node<T>* ar1,Node<T>* ar2)
It returns true if the nodes of ar1 and ar2 with the same position have the same value, and ar1 and ar2 have the same length; otherwise, it returns false.

0 0
Add a comment Improve this question Transcribed image text
Answer #1

Note:- I have done the code, but without any inputs do check this code, and if any error showing with input please do commend I will check it rectify it.

code

#include <stdio.h>
using namespace std;
template <typename T> bool Equal(Node<T>* ar1,Node<T>* ar2)
{
if((ar1.value==ar2.value)&&(ar1.length==ar2.length))
return 1;
else
return 0;
}
int main()
{
   return 0;
}

2 3 Welcome to GDB Online. 4 GDB online is an online compiler and debugger tool for C, C++, Python, Ja 5 C#, VB, Swift, Pasca

Add a comment
Know the answer?
Add Answer to:
answer in c++ please , Your objective is to write the definition of the function Equal()...
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • need this urgent please thank you very much 1.4 A sequence is a palindrome if it...

    need this urgent please thank you very much 1.4 A sequence is a palindrome if it reads the same backward as forward. For example, the string "rammar" is a palindrome. The function palindrome (1st) returns true if 1st is a palindrome, and false otherwise. Complete the definition. template <typename T> bool palindrome (onst isT 1st)

  • C language please Write the definition of a function isSenior, which receives an integer parameter and...

    C language please Write the definition of a function isSenior, which receives an integer parameter and returns true if the parameter's value is greater or equal to 65, and false otherwise. So if the parameter's value is 7 or 64 or 12 the function returns false. But if the parameter's value is 69 or 83 or 65 the function returns true.

  • Ouestion 4 Write the code of the compareLists) function below that returns true if and only...

    Ouestion 4 Write the code of the compareLists) function below that returns true if and only if two singly-linked lists are equal (ie. store the same data). You may asssume that the usual comparison operators are available in the Object class. (4 marks) template <typename Object> bool compareLists( Node<Object>* p, Node<Object>* q ) {

  • -PLEASE PROVIDE CLEAR AND CONCISE C++ CODE THAT HAS BEEN TESTED AND WORKS PROPERLY -PLEASE PROVIDE...

    -PLEASE PROVIDE CLEAR AND CONCISE C++ CODE THAT HAS BEEN TESTED AND WORKS PROPERLY -PLEASE PROVIDE WRITTEN CODE AND SCREENSHOT OF CODE - PLEASE DO NOT USE STL LIBRARIES - WRITE CODE BY MODIFYING GIVEN CODE - SUBJECT IS DATA STRUCTURES 4. Define the function InsertionSort() whose header is template <typename T> void InsertionSort (Node<T>* root) Given that root is a doubly linked node, the function sorts the data of the linked list pointed to by root using the insertion...

  • Answer the following question(s) concerning implementing recursive functions to perform operations on linked lists of nodes...

    Answer the following question(s) concerning implementing recursive functions to perform operations on linked lists of nodes arranged as binary trees. For these questions, use the following struct definition for the nodes of the tree (we will not templatize the node here, so you do not have to write template functions for these questions, just assume trees of <int> values): struct BinaryTreeNode { int item; BinaryTreeNode* left; BinaryTreeNode* right; }; ---------------------------------------------- Given a node for a Binary Tree and an (integer)...

  • What is the specific answer for 1. and 2. Thanks! Add a new method, find, to...

    What is the specific answer for 1. and 2. Thanks! Add a new method, find, to class SinglyLinkedList (defined here) that takes as input a “data” value and returns a pointer to a node. If the input data is present in the linked list, the returned pointer should point to that node; if not, the returned pointer is nullptr. Write the (single line) method declaration/specification. Write the method definition/implementation. Test by running the main() function below and capture the console...

  • I'm just not sure how to tackle all the template class this header wants me to...

    I'm just not sure how to tackle all the template class this header wants me to write. I got this far into making the template for public and private and would like help on the template functions. Thank you! This is in C++ by the way. #include <iostream> #include <cassert> using namespace std; #ifndef ARRAYLIST_H #define ARRAYLIST_H template<typename T> class arrayList { public:    arrayList(); //Constructor with default parameter. //Sets maxSize = 100 and length = 0 if no parameter...

  • Using an appropriate definition of ListNode, design a simple linked list class called StringList with the...

    Using an appropriate definition of ListNode, design a simple linked list class called StringList with the following member functions: void add (std::string); int positionOf (std::string); bool setNodeVal(int, std::string); std::vector<std::string> getAsVector(); a default constructor a copy constructor a destructor The add() function adds a new node containing the value of the parameter to the end of the list. The positionOf() function returns the (zero-based) position in the list for the first occurrence of the parameter in the list, or -1 if...

  • In this assignment, you will implement a sort method on singly-linked and doubly-linked lists. Implement the...

    In this assignment, you will implement a sort method on singly-linked and doubly-linked lists. Implement the following sort member function on a singly-linked list: void sort(bool(*comp)(const T &, const T &) = defaultCompare); Implement the following sort member function on a doubly-linked list: void sort(bool(*comp)(const T &, const T &) = defaultCompare); The sort(…) methods take as a parameter a comparator function, having a default assignment of defaultCompare, a static function defined as follows: template <typename T> static bool defaultCompare(const...

  • please answer only if you know data structures question provide C++ code please 4. Write definition...

    please answer only if you know data structures question provide C++ code please 4. Write definition of the function LetterCount() whose header is int LetterCount(string word) It returns the count of the distinct letters in word while ignoring case.

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT