Skip to content

homework - #11

Open
VladimirSpe wants to merge 8 commits into
DafeMipt213:mainfrom
VladimirSpe:homework
Open

homework#11
VladimirSpe wants to merge 8 commits into
DafeMipt213:mainfrom
VladimirSpe:homework

Conversation

@VladimirSpe

Copy link
Copy Markdown

No description provided.

@github-actions github-actions Bot left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

clang-tidy made some suggestions

There were too many comments to post at once. Showing the first 25 out of 48. Check the log or trigger a new build to see more.

int V;
list<int>* adj;

void SCCUtil(int u, int disc[], int low[],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]

    void SCCUtil(int u, int disc[], int low[],
                        ^

int V;
list<int>* adj;

void SCCUtil(int u, int disc[], int low[],

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]

    void SCCUtil(int u, int disc[], int low[],
                                    ^

list<int>* adj;

void SCCUtil(int u, int disc[], int low[],
stack<int>* st, bool stackMember[]);

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: do not declare C-style arrays, use std::array<> instead [cppcoreguidelines-avoid-c-arrays]

                 stack<int>* st, bool stackMember[]);
                                 ^


Graph::Graph(int V)
{
this->V = V;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'V' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]

additional_tasks/Author's tasks/Task A/src/solution.cpp:18:

- Graph::Graph(int V)
+ Graph::Graph(int V) : V(V)
Suggested change
this->V = V;

Graph::Graph(int V)
{
this->V = V;
adj = new list<int>[V];

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: 'adj' should be initialized in a member initializer of the constructor [cppcoreguidelines-prefer-member-initializer]

additional_tasks/Author's tasks/Task A/src/solution.cpp:18:

- Graph::Graph(int V)
+ Graph::Graph(int V), adj(new list<int>[V])
Suggested change
adj = new list<int>[V];


template <template <class> class T>
vector<int> Dijkstra(EDGES_LISTS &edges_lists, int start_vertex) {
int n = edges_lists.size();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'n' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int n = edges_lists.size();
int const n = edges_lists.size();


template <template <class> class T>
vector<int> Dijkstra(EDGES_LISTS &edges_lists, int start_vertex) {
int n = edges_lists.size();

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: narrowing conversion from 'size_type' (aka 'unsigned long') to signed type 'int' is implementation-defined [cppcoreguidelines-narrowing-conversions]

  int n = edges_lists.size();
          ^

heap.Insert({0, start_vertex});

while (!heap.IsEmpty()) {
int v = heap.GetMinimum().second;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'v' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int v = heap.GetMinimum().second;
int const v = heap.GetMinimum().second;

}
used[v] = true;
for (auto i : edges_lists[v]) {
int u = i.first, d = i.second;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'u' of type 'int' can be declared 'const' [misc-const-correctness]

      int u = i.first, d = i.second;
      ^

used[v] = true;
for (auto i : edges_lists[v]) {
int u = i.first, d = i.second;
int new_dist = distance[v] + d;

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

warning: variable 'new_dist' of type 'int' can be declared 'const' [misc-const-correctness]

Suggested change
int new_dist = distance[v] + d;
int const new_dist = distance[v] + d;

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant