
This is the function which is desired. It might be required to change a little based on how it is being called and used, so modify accordingly for accurate result.
static int locofMin(String[] a, int posi)
{
int pos=0;
String temp;
String[] arr1=a;
String[] arr2=a;
if(posi==0)
{
pos=posi;
}
else
{
for(int i=0;i<posi-1;i++)
{
for(int j=i+1;j<posi;j++)
{
if (arr1[i].compareTo(arr1[j])>0)
{
temp = arr1[i];
arr1[i] = arr1[j];
arr1[j] = temp;
}
}
}
for(int ak=0;ak<posi;ak++)
{
System.out.println("arr1 :"+arr1[ak]);
System.out.println("arr2 :"+arr2[ak]);
}
for(int i1=0;i1<posi-1;i1++)
{
for(int k1=0;k1<posi;k1++)
{
if(arr1[i1].equals( arr2[k1] ))
{
pos=k1;
System.out.println("arr1[i1] "+arr1[i1]+"
arr2[k1]"+arr2[k1]);
break;
}
}
}
}
return pos;
}
Can you make this a function? Thank you. int locationOfMin(const string a[], int n): Return the...
Please help with this function i'm having trouble with: must be written in c++ All of the functions you must write take at least two parameters: an array of strings, and the number of items the function will consider in the array, starting from the beginning. Your implementations must not use any global variables whose values may be changed during execution. Your program must build successfully under both Visual C++ and either clang++ or g++. Your program must not use...
Write function in C++:
int removeDups (string a[], int n); For every sequence of consecutive identical items in a, retain only one item of that sequence. Suppose we call the number of retained items r. Then when this function returns, elements through of a must contain the retained items (in the same relative order they were in originally), and the remaining elements may have whatever values you want. Return the number of retained items. Here's an example: string [9] =...
Please help with this function i'm having trouble with: must be written in c++ All of the functions you must write take at least two parameters: an array of strings, and the number of items the function will consider in the array, starting from the beginning. Your implementations must not use any global variables whose values may be changed during execution. Your program must build successfully under both Visual C++ and either clang++ or g++. Your program must not use...
Need help with these array problems. int countAllPunctuation( const string array[ ], int n ); Return the total number of punctuation symbols found in all the elements of the passed array argument. For the purpose of this function, the characters '.' , ',', '!', ';', ''', '-', '/', ':', '?', '"' count as punctuation symbols (that is, period, comma, exclamation mark, semicolon, apostrophe, dash, slash, colon, question mark, and double quote). Return -1 if n <= 0. For example, for...
C++ ONLY Write a function, int flip(string a[], int n); It
reverses the order of the elements of the array and returns n. The
variable n will be greater than or equal to zero.
Example:
string array[6] = { "a", "b", "", "c", "d", "e" };
int q = flip(array, 4); // returns 4
// array now contains: "c" "" "b" "a" "d" "e"
Write a function, int flip(string a[], int n); It reverses the order of the elements of...
How do I do this? -> string print() const; Function to output the data, return the output in the form of string, with all elements in the hash table included and each seperated by a space this is my code: template <class elemType> string hashT<elemType>::print() const { for (int i = 0; i < HTSize; i++){ if (indexStatusList[i] == 1){ cout <<HTable[i]<< " " << endl; } } } **********Rest of the code...
C++ language
Write a function, int flip(string a[], int n); It reverses the order of the elements of the array and returns n. The variable n will be greater than or equal to zero. Example: string array[6] = { "a", "b", "", "c", "d", "e" }; int q = flip(array, 4); // returns 4 // array now contains: "C" "" "" "a" "d" "e" O Full Screen 1 code.cpp + New #include <string> 2 using namespace std; 3 4- int...
Write a generic function int find_lower_bound(T seq[], int n, const T& value). The function returns the index of the largest element in the given sequence that is less than the given value. If multiple elements satisfy, return the one with smallest index. Return -1 if no such element exists. //main.cpp #include<iostream> #include<string> #include<vector> #include<algorithm> using namespace std; #include "source.h" struct Point{ int x,y; bool operator<(const Point& p) { return (x<p.x || (x==p.x&&y<p.y)); } }; int...
//codes in DynamicString.cpp #include "DynamicString.h" int DynamicString::myStringLen(const char* str){ //TODO::Implement me return -1; } DynamicString::DynamicString(){ //TODO::1::Implement me } DynamicString::DynamicString(const char* str){ //TODO::1::Implement me } int DynamicString::len() const{ //TODO::1::Implement me return -1; } const char* DynamicString::c_str() const{ //TODO::1::Implement me return nullptr; } char& DynamicString::char_at(int position){ //TODO::1::Implement me char* a = new char('a'); return *a; } char DynamicString::char_at(int position) const{ //TODO::1::Implement me return 'a'; } char& DynamicString::operator[](int position){ //TODO::1::Implement me char* a = new char('a'); return *a; } char DynamicString::operator[](int position) const{...
Make sure to create the code with the given functions, and do not overlook them, do not create your own functions. This is an assignment that I did on my own and that's passed due, therefore, for educational purposes, I am interested to know what are other ways to properly program this. Please follow instructions as I am doing my best to fully understand every crucial detail in order to become a better programmer who is able to come up...